diff --git a/src/models/targethours.ts b/src/models/targethours.ts index 2e080459..dd2dc048 100644 --- a/src/models/targethours.ts +++ b/src/models/targethours.ts @@ -1,25 +1,74 @@ -export type TargethoursRow = { +export enum TargethoursRowType { + Weekly = "weekly", + Monthly = "monthly", +} + +type CommonTargethoursRow = { + /** The ID of the target hour settings */ id: number; - usersId: number; - type: string; + /** + * Date from which on the target hours apply + * Format YYYY-MM-DD + */ dateSince: string; + /** + * Date until which the target hours apply + * Format YYYY-MM-DD + */ dateUntil: string | null; + /** + * Automatic time compensation per month in hours + */ + compensationMonthly: number; + /** The related employee's ID */ + usersId: number; +}; + +export type TargethoursRowWeekly = CommonTargethoursRow & { + /** Type of the target hours row */ + type: TargethoursRowType.Weekly; + /** Target hours for Monday */ monday: number; + /** Target hours for Tuesday */ tuesday: number; + /** Target hours for Wednesday */ wednesday: number; + /** Target hours for Thursday */ thursday: number; + /** Target hours for Friday */ friday: number; + /** Target hours for Saturday */ saturday: number; + /** Target hours for Sunday */ sunday: number; + /** + * true if credited absence hours are applied against the average target hours, + * false if credited absence hours match the target hours of the specific day . + */ absenceFixedCredit: boolean; + /** Automatic time compensation per day in minutes */ compensationDaily: number; - compensationMonthly: number; +}; + +export type TargethoursRowMonthly = CommonTargethoursRow & { + /** Type of the target hours row */ + type: TargethoursRowType.Monthly; + /** Monthly target hours to attain */ monthlyTarget: number; + /** Is Monday a work day? */ workdayMonday: boolean; + /** Is Tuesday a work day? */ workdayTuesday: boolean; + /** Is Wednesday a work day? */ workdayWednesday: boolean; + /** Is Thursday a work day? */ workdayThursday: boolean; + /** Is Friday a work day? */ workdayFriday: boolean; + /** Is Saturday a work day? */ workdaySaturday: boolean; + /** Is Sunday a work day? */ workdaySunday: boolean; }; + +export type TargethoursRow = TargethoursRowWeekly | TargethoursRowMonthly;