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

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

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

    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'> & {
        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 OvertimeApplicationStatusLog {
      id: string;
      applicationId: string;
      actionType: OvertimeApplicationActionType;
      fromStatus?: string | null;
      toStatus: string;
      reason?: string | null;
      operatorUserId: string;
      operatorName: string;
      applicantNameSnapshot: string;
      overtimeDateSnapshot: string;
      overtimeDurationSnapshot: string;
      remark?: string | null;
      createTime: string;
    }
  }
}
