import { WORKDAYS } from '@humand-packages/common';
import { AutoIncrement, Column, DataType, ForeignKey, HasMany, Model, PrimaryKey, Table } from 'sequelize-typescript';
import { TimeSlotDAO } from './timeSlots';
import { WorkScheduleDAO } from './workSchedule';

export interface ScheduledDaysDAOCreationAttributes {
    dayOfWeek: WORKDAYS;
    workScheduleId: number;
}

@Table({ tableName: 'ScheduledDays', timestamps: false })
export class ScheduledDaysDAO extends Model<ScheduledDaysDAO, ScheduledDaysDAOCreationAttributes> {
    @PrimaryKey
    @AutoIncrement
    @Column
    id!: number;

    @Column(DataType.STRING)
    dayOfWeek!: WORKDAYS;

    @HasMany(() => TimeSlotDAO)
    timeSlots!: TimeSlotDAO[];

    @ForeignKey(() => WorkScheduleDAO)
    @Column
    workScheduleId!: number;
}
