import {
    AutoIncrement,
    BelongsTo,
    Column,
    CreatedAt,
    DataType,
    DeletedAt,
    ForeignKey,
    Model,
    PrimaryKey,
    Table,
    UpdatedAt,
} from 'sequelize-typescript';
import { TimeTrackingDaySummaryDAO } from './daySummary';

export interface TimeTrackingDaySummaryHolidayCreationAttributes {
    daySummaryId: number;
    holidayId: number;
    holidayName: string;
}

@Table({
    tableName: 'TimeTrackingDaySummariesHoliday',
})
export class TimeTrackingDaySummaryHolidayDAO extends Model<TimeTrackingDaySummaryHolidayDAO, TimeTrackingDaySummaryHolidayCreationAttributes> {
    @PrimaryKey
    @AutoIncrement
    @Column
    id!: number;

    @Column(DataType.INTEGER)
    @ForeignKey(() => TimeTrackingDaySummaryDAO)
    daySummaryId!: number;

    @Column(DataType.INTEGER)
    holidayId!: number;

    @Column(DataType.STRING)
    holidayName!: string;

    @CreatedAt
    @Column(DataType.DATE)
    createdAt!: Date;

    @UpdatedAt
    @Column(DataType.DATE)
    updatedAt!: Date;

    @DeletedAt
    @Column(DataType.DATE)
    deletedAt!: Date | null;

    @BelongsTo(() => TimeTrackingDaySummaryDAO)
    daySummary!: TimeTrackingDaySummaryDAO;
}
