import { OptionalNullable } from '@humand-packages/common';
import { TimeTrackingPolicyApprovalStepResponsibleRelation } from './responsibles/relation';
import { TimeTrackingPolicyApprovalStepResponsibleSegmentationItem } from './responsibles/segmentationItem';
import { TimeTrackingPolicyApprovalStepResponsibleUser } from './responsibles/user';

export class TimeTrackingPolicyApprovalStepForCreation {
    constructor(properties: OptionalNullable<TimeTrackingPolicyApprovalStepForCreation>) {
        this.instanceId = properties.instanceId;
        this.position = properties.position;
        this.policyId = properties.policyId ?? null;
        this.designatedReviewer = properties.designatedReviewer ?? null;
    }

    public readonly instanceId: number;
    public readonly position: number;
    public readonly policyId: number | null;
    public designatedReviewer: boolean | null;
}

export class TimeTrackingPolicyApprovalStep extends TimeTrackingPolicyApprovalStepForCreation {
    constructor(properties: OptionalNullable<TimeTrackingPolicyApprovalStep>) {
        super(properties);
        this.id = properties.id;
        this.createdAt = properties.createdAt;
        this.updatedAt = properties.updatedAt;
        this.deletedAt = properties.deletedAt ?? null;
        this.responsibleRelations = properties.responsibleRelations ?? null;
        this.responsibleUsers = properties.responsibleUsers ?? null;
        this.responsibleSegmentationItems = properties.responsibleSegmentationItems ?? null;
        this.designatedReviewer = properties.designatedReviewer ?? null;
    }

    public id: string;
    public createdAt: Date;
    public updatedAt: Date;
    public deletedAt: Date | null;
    public responsibleRelations: TimeTrackingPolicyApprovalStepResponsibleRelation[] | null;
    public responsibleUsers: TimeTrackingPolicyApprovalStepResponsibleUser[] | null;
    public responsibleSegmentationItems: TimeTrackingPolicyApprovalStepResponsibleSegmentationItem[] | null;
}
