export type FilterFieldConfig = {
  serviceItemsIn: () => string;
  agentsIn: () => string;
  agentGroupsIn: () => string;
  creationDateFrom: () => string;
  creationDateTo: () => string;
  dateOptions: {
    lastSevenDays: () => string;
    lastFourteenDays: () => string;
    lastThirtyDays: () => string;
    dateRange: () => string;
  };
  // Optional fields (only in coordinatorTaskFilters)
  statesIn?: () => string;
  initiatorsIn?: () => string;
  collaboratorTypesIn?: () => string;
};

export const filterFields = {
  statesIn: () => 'statesIn' as const,
  serviceItemsIn: () => 'serviceItemsIn' as const,
  creationDateFrom: () => 'creationDateFrom' as const,
  creationDateTo: () => 'creationDateTo' as const,
  initiatorsIn: () => 'initiatorsIn' as const,
  initiatorCollaboratorTypesIn: () => 'initiatorCollaboratorTypesIn' as const,
  agentsIn: () => 'agentsIn' as const,
};

export const coordinatorTaskFilters = {
  serviceItemsIn: () => 'serviceItemsIn' as const,
  agentGroupsIn: () => 'agentGroupsIn' as const,
  statesIn: () => 'statesIn' as const,
  initiatorsIn: () => 'initiatorsIn' as const,
  agentsIn: () => 'agentsIn' as const,
  creationDateFrom: () => 'creationDateFrom' as const,
  creationDateTo: () => 'creationDateTo' as const,
  dateOptions: {
    all: () => 'dateOptions' as const,
    lastSevenDays: () =>
      `${coordinatorTaskFilters.dateOptions.all()}.lastSevenDays` as const,
    lastFourteenDays: () =>
      `${coordinatorTaskFilters.dateOptions.all()}.lastFourteenDays` as const,
    lastThirtyDays: () =>
      `${coordinatorTaskFilters.dateOptions.all()}.lastThirtyDays` as const,
    dateRange: () =>
      `${coordinatorTaskFilters.dateOptions.all()}.dateRange` as const,
  },
  collaboratorTypesIn: () => 'collaboratorTypesIn' as const, // OXXO only
};

export const coordinatorDashboardFilters = {
  serviceItemsIn: () => 'serviceItemsIn' as const,
  agentsIn: () => 'agentsIn' as const,
  agentGroupsIn: () => 'agentGroupsIn' as const,
  creationDateFrom: () => 'creationDateFrom' as const,
  creationDateTo: () => 'creationDateTo' as const,
  dateOptions: {
    all: () => 'dateOptions' as const,
    lastSevenDays: () =>
      `${coordinatorTaskFilters.dateOptions.all()}.lastSevenDays` as const,
    lastFourteenDays: () =>
      `${coordinatorTaskFilters.dateOptions.all()}.lastFourteenDays` as const,
    lastThirtyDays: () =>
      `${coordinatorTaskFilters.dateOptions.all()}.lastThirtyDays` as const,
    dateRange: () =>
      `${coordinatorTaskFilters.dateOptions.all()}.dateRange` as const,
  },
};

export const tasksReportFormFields = {
  email: () => 'email' as const,
  includeProfileFields: () => 'includeProfileFields' as const,
  includeSegmentations: () => 'includeSegmentations' as const,
  profileFields: () => 'profileFields' as const,
  segmentations: () => 'segmentations' as const,
  reportType: () => 'reportType' as const,
};

export const subtasksFilters = {
  statesIn: () => 'statesIn' as const,
  parentTaskCatalogItemsIn: () => 'parentTaskCatalogItemsIn' as const,
  parentTaskInitiatorsIn: () => 'parentTaskInitiatorsIn' as const,
  createdAtFrom: () => 'createdAtFrom' as const,
  createdAtTo: () => 'createdAtTo' as const,
  dateOptions: {
    lastSevenDays: () => 'dateOptions.lastSevenDays' as const,
    lastFourteenDays: () => 'dateOptions.lastFourteenDays' as const,
    lastThirtyDays: () => 'dateOptions.lastThirtyDays' as const,
    dateRange: () => 'dateOptions.dateRange' as const,
  },
};

export const pendingApprovalsFilters = {
  parentTaskCatalogItemsIn: () => 'parentTaskCatalogItemsIn' as const,
  parentTaskInitiatorsIn: () => 'parentTaskInitiatorsIn' as const,
  createdAtFrom: () => 'createdAtFrom' as const,
  createdAtTo: () => 'createdAtTo' as const,
  dateOptions: {
    lastSevenDays: () => 'dateOptions.lastSevenDays' as const,
    lastFourteenDays: () => 'dateOptions.lastFourteenDays' as const,
    lastThirtyDays: () => 'dateOptions.lastThirtyDays' as const,
    dateRange: () => 'dateOptions.dateRange' as const,
  },
};

export const historyApprovalsFilters = {
  parentTaskCatalogItemsIn: () => 'parentTaskCatalogItemsIn' as const,
  statesIn: () => 'statesIn' as const,
  parentTaskInitiatorsIn: () => 'parentTaskInitiatorsIn' as const,
  completedAtFrom: () => 'completedAtFrom' as const,
  completedAtTo: () => 'completedAtTo' as const,
  dateOptions: {
    lastSevenDays: () => 'dateOptions.lastSevenDays' as const,
    lastFourteenDays: () => 'dateOptions.lastFourteenDays' as const,
    lastThirtyDays: () => 'dateOptions.lastThirtyDays' as const,
    dateRange: () => 'dateOptions.dateRange' as const,
  },
};
