import { AutoIncrement, Column, DataType, DeletedAt, ForeignKey, Model, PrimaryKey, Table } from 'sequelize-typescript';
import { InstanceDAO } from '../../../instances/infrastructure/dataAccessObjects/instanceDAO';
import { TimeTrackingKioskLinkForCreation } from '../../business/models/timeTrackingKioskLink';
import { TimeTrackingKioskDAO } from './kiosk';

@Table({ tableName: 'TimeTrackingKiosksLinks' })
export class TimeTrackingKioskLinkDAO extends Model<TimeTrackingKioskLinkDAO, TimeTrackingKioskLinkForCreation> {
    @PrimaryKey
    @AutoIncrement
    @Column
    id!: number;

    @Column
    code!: string;

    @Column
    @ForeignKey(() => InstanceDAO)
    instanceId?: number;

    @Column
    @ForeignKey(() => TimeTrackingKioskDAO)
    kioskId?: number;

    @Column
    expirationInMinutes?: number;

    @Column({ type: DataType.DATE })
    expirationDate!: Date | null;

    @Column
    status!: string;

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