import { httpGetInterceptor, httpPostInterceptor } from "../http-config/http-interceptor-service";


export async function getAgendaSettingsById(id: any) {
  const url = `agenda-settings?id=${id}`;
  return httpGetInterceptor(url);
}

export async function getAgendaSettingsList(year = "", month = "", type = "") {
  const url = `agenda-settings/list?year=${year}&month=${month}&type=${type}`;
  return httpGetInterceptor(url);
}

export async function saveAgendaSettings(data: any) {
  const url = `agenda-settings`;
  return httpPostInterceptor(url, data);
}

export async function getPlanningDailyByTypeId(
  page: number,
  size = 10,
  parentId: any,
  date: string,
  typeId: number
) {
  const url = `planning/pagination/daily?enablePage=1&time=1&size=${size}&page=${page}&date=${date}&typeId=${typeId}${
    parentId ? `&parentId=${parentId}` : ""
  }`;
  return httpGetInterceptor(url);
}

export async function getMonthlyPlanList(dates: any, typeId: number) {
  const url = `planning/monthly/list?date=${dates}&typeId=${typeId}`;
  return httpGetInterceptor(url);
}

export async function getWeeklyPlanList(
  dates: number | undefined,
  typeId: number,
  isMonthly = false
) {
  const url = `planning/weekly/list?date=${dates}&typeId=${typeId}&isMonthly=${isMonthly}`;
  return httpGetInterceptor(url);
}

export async function getWeeklyPlanListByParentId(id: string, typeId: number) {
  const url = `planning/weekly/list?parentId=${id}&typeId=${typeId}`;
  return httpGetInterceptor(url);
}

export async function getPlanningPagination(
  page: number,
  title = "",
  size = 10,
  typeId: number,
  time: number,
  parentId = ""
) {
  const url = `planning/pagination?enablePage=1&size=${size}&page=${page}&title=${title}&typeId=${typeId}&time=${time}&parentId=${parentId}`;
  return httpGetInterceptor(url);
}

export async function savePlanning(data: any) {
  const url = "planning";
  return httpPostInterceptor(url, data);
}

export async function getPlanningMonthlyPerSocmed(
  month = "",
  year = "",
  typeId: number,
  parentId = ""
) {
  const url = `planning/socmed/monthly?month=${month}&year=${year}&typeId=${typeId}&parentId=${parentId}`;
  return httpGetInterceptor(url);
}

export async function getPlanningDailyMedsosByPlatform(
  page: string,
  size = 10,
  date: string,
  platformTypeId: string
) {
  const url = `planning/pagination/daily?enablePage=1&size=${size}&page=${page}&date=${date}&typeId=2&platformTypeId=${platformTypeId}`;
  return httpGetInterceptor(url);
}
