import {
  LoadArticleResponse,
  LoadCategoryResponse,
} from "../services/article/types";
import {
  LoadBannerResponse,
  LoadDeviceMetaResponse,
  LoadFaqCategoryResponse,
  LoadFaqResponse,
  LoadReviewResponse,
} from "../services/content/types";
import { BaseApi } from "./baseApi";

class ContentApi extends BaseApi {
  constructor() {
    super("/content");
  }

  async LoadBanner({ pageNumber, pageSize, position = "home" }) {
    return this.authPost<LoadBannerResponse>("/banner", {
      pageNumber,
      pageSize,
      position,
    });
  }

  async LoadReview({ pageNumber, pageSize, isFeatured = true }) {
    return this.authPost<LoadReviewResponse>("/review", {
      pageNumber,
      pageSize,
      isFeatured,
    });
  }

  async LoadFaqCategory({ pageNumber, pageSize, parentId = null }) {
    return this.authPost<LoadFaqCategoryResponse>("/faq-category", {
      pageNumber,
      pageSize,
      parentId,
    });
  }

  async LoadFaq({ pageNumber, pageSize, categoryId = null, isFeatured }) {
    return this.authPost<LoadFaqResponse>("/faq", {
      pageNumber,
      pageSize,
      categoryId,
      isFeatured,
    });
  }

  // async LoadFaqGuide({
  //   pageNumber,
  //   pageSize,
  //   categoryId = 1,
  //   isFeatured = false,
  // }) {
  //   return this.authPost<LoadFaqResponse>("/faq", {
  //     pageNumber,
  //     pageSize,
  //     categoryId,
  //     isFeatured,
  //   });
  // }

  async LoadDeviceMetaData() {
    return this.authGet<LoadDeviceMetaResponse>("/device-metadata");
  }
}

export const contentApi = new ContentApi();
