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

export interface TimeTrackingPolicyApprovalStepResponsibleSegmentationItemCreationAttributes {
    approvalStepId: string;
    segmentationItemId: number;
}

@Table({
    tableName: 'TimeTrackingPolicyApprovalStepResponsibleSegmentationItems',
})
export class TimeTrackingPolicyApprovalStepResponsibleSegmentationItemDAO extends Model<
    TimeTrackingPolicyApprovalStepResponsibleSegmentationItemDAO,
    TimeTrackingPolicyApprovalStepResponsibleSegmentationItemCreationAttributes
> {
    @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
    segmentationItemId!: number;
}
