export interface PendingApprovalDto {
  content: any;
  id: string;
  status: "active" | "inactive"; // You can adjust the union if other statuses exist
  createdAt: string;
  updatedAt: string;
  record: PendingApprovalRecordDto;
  onReview?: boolean;
  letterName?: string; // Add letterName field for file name column
}

export interface PositionName {
  am: string;
  en: string;
}

export interface Unit {
  id: string;
  name: PositionName;
}

export interface Position {
  id: string;
  name: PositionName;
}

export interface ApproverName {
  am: string;
  en: string;
}

export interface ApproverEmployee {
  id: string;
  name: ApproverName;
}

export interface ApproverPosition {
  id: string;
  name: ApproverName;
}

export interface EmployeePosition {
  id: string;
  employee: ApproverEmployee;
  position: ApproverPosition;
}

export interface Record {
  recordTypeKey: string;
  receivingUnits: any;
  id: string;
  referenceNumber: string | null;
  letterName?: string; // Add letterName field
  initiator?: {
    id: string;
    employee: {
      id: string;
      name: {
        am: string;
        en: string;
      };
    };
    position: {
      id: string;
      name: {
        am: string;
        en: string;
      };
    };
  };
  statusKey: string;
}

export interface RecordContent {
  nonSmartOfficeReceivers: any;
  id: string;
  subject: string;
  recordId: string;
  record: Record;
  recordTypeKey: string;
  receivingUnits: ReceivingUnitDto[];
  receiverEmployees: ReceiverEmployeeDto[];
  receiverPositions: ReceiverPositionDto[];
}

export interface ReceiverPositionDto {
  id: string;
  position: {
    id: string;
    name: {
      am: string;
      en: string;
    };
  };
}

export interface PendingApprovalRecordDto {
  preferredLanguage: string;
  id: string;
  recordTypeKey: "internal" | "external" | "internal_memo"; // Extend this union if needed
  referenceNumber: string | null;
  content: PendingApprovalContentDto[];
  receivingUnits: ReceivingUnitDto[];
  amharicSubmittedDate: string;
  submittedDate: string;
  isSecured: boolean;
  isUrgent: boolean;
  letterName?: string;
  isWithTeamSignature?: boolean;
  initiator?: {
    id: string;
    employee: {
      id: string;
      name: {
        am: string;
        en: string;
      };
    };
    position: {
      id: string;
      name: {
        am: string;
        en: string;
      };
    };
  };

  statusKey: string;
}

export interface PendingApprovalContentDto {
  nonSmartOfficeReceivers: any;
  id: string;
  subject: string;
  receiverPositions: ReceiverPositionDto[];
  receiverEmployees: ReceiverEmployeeDto[];
}

export interface ReceiverEmployeeDto {
  id: string;
  employeePosition: {
    id: string;
    employee: {
      id: string;
      name: {
        am: string;
        en: string;
      };
    };
    position?: {
      id: string;
      name: {
        am: string;
        en: string;
      };
    };
  };
}

export interface ReceiverPositionDto {
  id: string;
  position: Position;
}

export interface ReceivingUnitDto {
  id: string;
  unit: Unit;
}
export interface MyApprovalRecordsDto {
  id: string;
  createdAt: string;
  updatedAt: string;
  submittedDate: string;
  amharicSubmittedDate: string;
  amharicCreatedAt: string; // Add amharicCreatedAt at root level as per backend response
  action: "approve" | "reject" | "send_back" | "active" | string;
  version: number;
  comment: string;
  employeePosition: EmployeePosition;
  recordContent: RecordContent;
  pageNo?: number;

  // ✅ Fix this line - record should include letterName and amharicCreatedAt
  // ✅ Fix this line - record should include letterName and amharicCreatedAt
  record: {
    id: string;
    submittedDate: string;
    amharicSubmittedDate: string;
    recordTypeKey: string;
    referenceNumber: string;
    statusKey: string;
    letterName?: string; // Add letterName field here where it actually exists in the backend response
    initiator?: {
      id: string;
      employee: {
        id: string;
        name: {
          am: string;
          en: string;
        };
      };
      position: {
        id: string;
        name: {
          am: string;
          en: string;
        };
      };
    };
    // Add any other fields you need from `record`
  };
}

export interface EmployeePosition {
  id: string;
  employee: {
    id: string;
    name: {
      am: string;
      en: string;
    };
  };
  position: {
    id: string;
    name: {
      am: string;
      en: string;
    };
  };
}

export interface ReceiverEmployee {
  id: string;
  employeePosition: EmployeePosition;
}

export interface RecordContentAlt {
  id: string;
  subject: string;
  recordId: string;
  receiverEmployees: ReceiverEmployee[];
  record: {
    id: string;
    referenceNumber: string | null;
    recordTypeKey: string;
    receivingUnits: Array<{
      id: string;
      unit: {
        id: string;
        name: {
          am: string;
          en: string;
        };
      };
    }>;
  };
}
