import { BelongsTo, Column, CreatedAt, DataType, DeletedAt, ForeignKey, Model, PrimaryKey, Table, UpdatedAt } from 'sequelize-typescript';
import { TimeTrackingCategorizedHourDAO } from '../hourCategory/categorizedHour';
import { TimeTrackingCategorizedHourApprovalStepDAO } from './timeTrackingCategorizedHourApprovalStepDAO';

export interface TimeTrackingCategorizedHourApprovalStepPotentialApproverCreationAttributes {
    approvalStepId: string;
    categorizedHourId: string;
    userId: number;
}

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

    @ForeignKey(() => TimeTrackingCategorizedHourApprovalStepDAO)
    @Column(DataType.UUID)
    approvalStepId!: string;

    @BelongsTo(() => TimeTrackingCategorizedHourApprovalStepDAO)
    approvalStep?: TimeTrackingCategorizedHourApprovalStepDAO;

    @ForeignKey(() => TimeTrackingCategorizedHourDAO)
    @Column(DataType.UUID)
    categorizedHourId!: string;

    @BelongsTo(() => TimeTrackingCategorizedHourDAO)
    categorizedHour?: TimeTrackingCategorizedHourDAO;

    @Column({ type: DataType.INTEGER })
    userId!: number;

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

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

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