/**
 * Type definitions for Requests page
 */

import type { DateRange } from '@/services/dashboard.service';

export interface RequestsProps {
  onViewRequest: (requestId: string, requestTitle?: string, status?: string) => void;
}

export interface RequestFilters {
  search?: string;
  status?: string;
  priority?: string;
  templateType?: string;
  /** When templateType is FORM_16, filter by Form 16A submission financial year */
  financialYear?: string;
  /** When templateType is FORM_16, filter by Form 16A submission quarter */
  quarter?: string;
  slaCompliance?: string;
  department?: string;
  initiator?: string;
  approver?: string;
  approverType?: 'current' | 'any';
  dateRange?: DateRange;
  startDate?: Date;
  endDate?: Date;
}

export interface RequestStats {
  total: number;
  pending: number;
  paused: number;
  approved: number;
  rejected: number;
  draft: number;
  closed: number;
}

export interface BackendStats {
  total: number;
  pending: number;
  paused: number;
  approved: number;
  rejected: number;
  draft: number;
  closed: number;
}

export interface User {
  userId: string;
  email: string;
  displayName?: string;
}

/** Form 16 submission summary for listing (total amount, credit note, display status) */
export interface Form16SubmissionSummary {
  totalAmount?: number | null;
  creditNoteNumber?: string | null;
  displayStatus?: string;
}

export interface ConvertedRequest {
  id: string;
  requestId: string;
  displayId: string;
  title: string;
  description: string;
  status: string;
  priority: string;
  department?: string;
  submittedDate?: string;
  createdAt: string | Date | undefined;
  currentApprover: string;
  approverLevel: string;
  templateType?: string;
  workflowType?: string;
  templateName?: string;
  /** Form 16: total amount, credit note number, display status (Balance mismatch, Failed, etc.) */
  form16Submission?: Form16SubmissionSummary | null;
}

