import {
  deleteAPIInterceptor,
  getAPI,
  getAPIInterceptor,
  postAPIInterceptor,
} from "../config/api";

export async function listDataMedia(
  page: any,
  limit: any,
  search: any,
  categoryFilter: any,
  statusFilter: any
) {
  const name = search || "";
  const url = `media/list?isForAdmin=true&title=${name}&enablePage=1&sortBy=createdAt&sort=desc&size=${limit}&page=${page}&typeId=1&categoryId=${categoryFilter}&statusId=${statusFilter}`;
  return getAPIInterceptor({ url });
}

export async function listDataVideo(
  isForSelf: any,
  isApproval: any,
  page: any,
  limit: any,
  search: any,
  categoryFilter: any,
  statusFilter: any,
  needApprovalFromLevel: any,
  creator: any,
  source: any,
  startDate: any,
  endDate: any
) {
  const name = search || "";
  const url = `media/list?title=${name}&enablePage=1&sortBy=createdAt&sort=desc&size=${limit}&page=${page}&typeId=2&isForSelf=${isForSelf}&isApproval=${isApproval}&categoryId=${categoryFilter}&statusId=${statusFilter}&needApprovalFromLevel=${needApprovalFromLevel}&creatorUserLevelName=${source}&creatorName=${creator}&startDate=${startDate}&endDate=${endDate}`;
  return getAPIInterceptor({ url });
}

export async function listDataImage(
  isForSelf: any,
  isApproval: any,
  page: any,
  limit: any,
  search: any,
  categoryFilter: any,
  statusFilter: any,
  needApprovalFromLevel: any,
  creator: any,
  source: any,
  startDate: any,
  endDate: any
) {
  const name = search || "";
  const url = `media/list?title=${name}&enablePage=1&sortBy=createdAt&sort=desc&size=${limit}&page=${page}&typeId=1&isForSelf=${isForSelf}&isApproval=${isApproval}&categoryId=${categoryFilter}&statusId=${statusFilter}&needApprovalFromLevel=${needApprovalFromLevel}&creatorUserLevelName=${source}&creatorName=${creator}&startDate=${startDate}&endDate=${endDate}`;
  return getAPIInterceptor({ url });
}

export async function listDataAll(
  isForSelf: any,
  isApproval: any,
  page: any,
  limit: any,
  search: any,
  fileTypeFilter: any,
  statusFilter: any,
  startDate: any,
  endDate: any,
  needApprovalFromLevel: any
) {
  const name = search || "";
  const url = `media/list?title=${name}&enablePage=1&sortBy=createdAt&sort=desc&size=${limit}&page=${page}&isForSelf=${isForSelf}&isApproval=${isApproval}&typeId=${fileTypeFilter}&statusId=${statusFilter}&startDate=${
    startDate == undefined ? "" : startDate
  }&endDate=${
    endDate == undefined ? "" : endDate
  }&needApprovalFromLevel=${needApprovalFromLevel}`;
  return getAPIInterceptor({ url });
}
