import type { Dayjs } from 'dayjs'; export interface CheckInFormValues { studentId: number; roomId: number; checkInDate: Dayjs; billingStartDate?: Dayjs; stayType?: string; collectDeposit?: boolean; depositAmount?: number; notes?: string; bedId: number; lockerId?: number; } export const buildCheckInPayload = (values: CheckInFormValues) => { const collectDeposit = values.collectDeposit ?? false; return { studentId: values.studentId, roomId: values.roomId, checkInDate: values.checkInDate.format('YYYY-MM-DD'), billingStartDate: (values.billingStartDate || values.checkInDate).format('YYYY-MM-DD'), stayType: values.stayType || 'short', collectDeposit, depositAmount: collectDeposit ? values.depositAmount ?? 500 : undefined, notes: values.notes?.trim() || undefined, bedId: values.bedId, lockerId: values.lockerId || undefined, }; }; export interface TransferFormValues { newRoomId: number; newBedId: number; newLockerId?: number; transferDate: Dayjs; oldBillingEndDate?: Dayjs; newBillingStartDate?: Dayjs; reason?: string; } export const buildTransferPayload = (values: TransferFormValues) => ({ newRoomId: values.newRoomId, newBedId: values.newBedId, newLockerId: values.newLockerId || undefined, transferDate: values.transferDate.format('YYYY-MM-DD'), oldBillingEndDate: values.oldBillingEndDate?.format('YYYY-MM-DD'), newBillingStartDate: values.newBillingStartDate?.format('YYYY-MM-DD'), reason: values.reason, });