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

export interface TimeTrackingPolicyApprovalStepResponsibleUserCreationAttributes {
    approvalStepId: string;
    userId: number;
}

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

    @CreatedAt
    @Column
    createdAt!: Date;

    @UpdatedAt
    @Column
    updatedAt!: Date;

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

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

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

    @Column
    userId!: number;
}
