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

export interface TimeTrackingPolicyApprovalStepResponsibleRelationCreationAttributes {
    approvalStepId: string;
    relation: string;
}

@Table({
    tableName: 'TimeTrackingPolicyApprovalStepResponsibleRelations',
})
export class TimeTrackingPolicyApprovalStepResponsibleRelationDAO extends Model<
    TimeTrackingPolicyApprovalStepResponsibleRelationDAO,
    TimeTrackingPolicyApprovalStepResponsibleRelationCreationAttributes
> {
    @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
    relation!: string;
}
