import { queryOptions } from '@tanstack/react-query';
import {
  getApprovalEscalationPolicies,
  getApprovalReminderPolicies,
  getPendingApprovalAutomationQueue
} from './service';

export const approvalAutomationKeys = {
  all: ['crm-approval-automation'] as const,
  pendingQueue: () => [...approvalAutomationKeys.all, 'pending-queue'] as const,
  reminderPolicies: () => [...approvalAutomationKeys.all, 'reminder-policies'] as const,
  escalationPolicies: () => [...approvalAutomationKeys.all, 'escalation-policies'] as const
};

export const pendingApprovalAutomationQueueOptions = () =>
  queryOptions({
    queryKey: approvalAutomationKeys.pendingQueue(),
    queryFn: () => getPendingApprovalAutomationQueue()
  });

export const approvalReminderPoliciesOptions = () =>
  queryOptions({
    queryKey: approvalAutomationKeys.reminderPolicies(),
    queryFn: () => getApprovalReminderPolicies()
  });

export const approvalEscalationPoliciesOptions = () =>
  queryOptions({
    queryKey: approvalAutomationKeys.escalationPolicies(),
    queryFn: () => getApprovalEscalationPolicies()
  });
