import type { IClient, IClientContract } from '@alga-psa/types';

export interface BillingCycleDateRange {
  from?: string;
  to?: string;
}

export interface ClientPaginationParams {
  page?: number;
  pageSize?: number;
  includeInactive?: boolean;
  searchTerm?: string;
  clientTypeFilter?: 'all' | 'company' | 'individual';
  statusFilter?: 'all' | 'active' | 'inactive';
  sortBy?: string;
  sortDirection?: 'asc' | 'desc';
  dateRange?: BillingCycleDateRange;
}

export interface PaginatedClientsResponse {
  clients: IClient[];
  totalCount: number;
  page: number;
  pageSize: number;
  totalPages: number;
}

export type ClientContractAssignmentCreateInput = {
  client_id: string;
  contract_id: string;
  template_contract_id?: string | null;
  start_date: string;
  end_date: string | null;
  is_active: boolean;
  renewal_mode?: 'none' | 'manual' | 'auto';
  notice_period_days?: number;
  renewal_term_months?: number;
  use_tenant_renewal_defaults?: boolean;
  renewal_due_date_action_policy?: 'queue_only' | 'create_ticket' | null;
  renewal_ticket_board_id?: string | null;
  renewal_ticket_status_id?: string | null;
  renewal_ticket_priority?: string | null;
  renewal_ticket_assignee_id?: string | null;
  po_required?: boolean;
  po_number?: string | null;
  po_amount?: number | null;
};

export type ClientContractAssignmentUpdateInput = Partial<IClientContract>;
