declare namespace Api {
  namespace OvertimeApplication {
    interface PageParams {
      pageNo: number;
      pageSize: number;
    }

    type OvertimeApplicationStatusCode = 'pending' | 'approved' | 'rejected';

    type OvertimeApplicationActionType = 'submit' | 'resubmit' | 'approve' | 'reject';

    interface OvertimeApplication {
      id: string;
      applicantId: string;
      applicantName: string;
      overtimeDate: string;
      overtimeDuration: string;
      overtimeReason: string;
      overtimeContent: string;
      approverId: string;
      approverName: string;
      statusCode: OvertimeApplicationStatusCode;
      statusName: string;
      allowEdit: boolean;
      terminal: boolean;
      approvalComment?: string | null;
      submitTime: string;
      approvalTime?: string | null;
      createTime: string;
      updateTime: string;
    }

    type OvertimeApplicationSearchParams = CommonType.RecordNullable<
      Pick<PageParams, 'pageNo' | 'pageSize'> & {
        applicantIds: string[] | null;
        keyword: string;
        applicantName: string;
        approverId: string;
        approverName: string;
        statusCode: OvertimeApplicationStatusCode;
        overtimeDate: string[];
        createTime: string[];
      }
    >;

    interface OvertimeApplicationPageResult {
      total: number;
      list: OvertimeApplication[];
    }

    interface SaveOvertimeApplicationParams {
      overtimeDate: string;
      overtimeDuration: string;
      overtimeReason: string;
      overtimeContent: string;
      approverId: string;
    }

    interface StatusActionParams {
      reason?: string | null;
    }

    interface OvertimeApplicationBatchActionParams {
      ids: string[];
      reason?: string | null;
    }

    interface OvertimeApplicationBatchFailItem {
      id: string;
      reason: string;
    }

    interface OvertimeApplicationBatchActionResult {
      successCount: number;
      failCount: number;
      failItems: OvertimeApplicationBatchFailItem[];
    }

    interface OvertimeApplicationApprovalRecord {
      id: string;
      overtimeApplicationId: string;
      statusLogId: string;
      approvalRound: number;
      conclusion: string;
      opinion?: string | null;
      auditorUserId: string;
      auditorName: string;
      createTime: string;
    }

    interface OvertimeApplicationStatusDict {
      statusCode: string;
      statusName: string;
      sort: number;
      initialFlag: boolean;
      terminalFlag: boolean;
      allowEdit: boolean;
    }

    interface TeamOvertimeSummaryParams {
      overtimeDateStart?: string | null;
      overtimeDateEnd?: string | null;
    }

    interface TeamOvertimeSummary {
      overtimeDateStart: string;
      overtimeDateEnd: string;
      totalApplicationCount: number;
      pendingCount: number;
      approvedCount: number;
      rejectedCount: number;
    }
  }
}
