import { Model, Table, Column, PrimaryKey, DataType, CreatedAt, UpdatedAt, DeletedAt, ForeignKey } from 'sequelize-typescript';
import { InstanceDAO } from '../../../../instances/infrastructure/dataAccessObjects/instanceDAO';
import { RegionDAO } from '../../../../regions/infrastructure/dataAccessObjects/regionDAO';
import { SiteDAO } from '../../../../regions/infrastructure/dataAccessObjects/siteDAO';
import { TimeTrackingKioskUserForCreation } from '../../../business/models/timeTracking/timeTrackingKioskUser';

@Table({
    tableName: 'TimeTrackingKioskUsers',
})
export class TimeTrackingKioskUserDAO extends Model<TimeTrackingKioskUserDAO, TimeTrackingKioskUserForCreation> {
    @PrimaryKey
    @Column(DataType.UUID)
    id!: string;

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

    @Column
    userId!: number;

    @ForeignKey(() => RegionDAO)
    @Column({ allowNull: true, type: DataType.INTEGER })
    regionId!: number | null;

    @ForeignKey(() => SiteDAO)
    @Column({ allowNull: true, type: DataType.INTEGER })
    siteId!: number | null;

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

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

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