var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import Incident from "./Incident";
import OnCallDutyPolicy from "./OnCallDutyPolicy";
import OnCallDutyPolicyEscalationRule from "./OnCallDutyPolicyEscalationRule";
import Project from "./Project";
import Team from "./Team";
import User from "./User";
import BaseModel from "./DatabaseBaseModel/DatabaseBaseModel";
import Route from "../../Types/API/Route";
import { PlanType } from "../../Types/Billing/SubscriptionPlan";
import ColumnAccessControl from "../../Types/Database/AccessControl/ColumnAccessControl";
import OwnedThrough from "../../Types/Database/AccessControl/OwnedThrough";
import TableAccessControl from "../../Types/Database/AccessControl/TableAccessControl";
import TableBillingAccessControl from "../../Types/Database/AccessControl/TableBillingAccessControl";
import CanAccessIfCanReadOn from "../../Types/Database/CanAccessIfCanReadOn";
import ColumnLength from "../../Types/Database/ColumnLength";
import ColumnType from "../../Types/Database/ColumnType";
import CrudApiEndpoint from "../../Types/Database/CrudApiEndpoint";
import EnableDocumentation from "../../Types/Database/EnableDocumentation";
import TableColumn from "../../Types/Database/TableColumn";
import TableColumnType from "../../Types/Database/TableColumnType";
import TableMetadata from "../../Types/Database/TableMetadata";
import TenantColumn from "../../Types/Database/TenantColumn";
import IconProp from "../../Types/Icon/IconProp";
import ObjectID from "../../Types/ObjectID";
import OnCallDutyPolicyStatus from "../../Types/OnCallDutyPolicy/OnCallDutyPolicyStatus";
import Permission from "../../Types/Permission";
import UserNotificationEventType from "../../Types/UserNotification/UserNotificationEventType";
import { Column, Entity, Index, JoinColumn, ManyToOne } from "typeorm";
import Alert from "./Alert";
import AlertEpisode from "./AlertEpisode";
import IncidentEpisode from "./IncidentEpisode";
import EnableWorkflow from "../../Types/Database/EnableWorkflow";
let OnCallDutyPolicyExecutionLog = class OnCallDutyPolicyExecutionLog extends BaseModel {
    constructor() {
        super(...arguments);
        this.project = undefined;
        this.projectId = undefined;
        this.onCallDutyPolicy = undefined;
        this.onCallDutyPolicyId = undefined;
        this.triggeredByIncident = undefined;
        this.triggeredByIncidentId = undefined;
        this.triggeredByAlert = undefined;
        this.triggeredByAlertId = undefined;
        this.triggeredByAlertEpisode = undefined;
        this.triggeredByAlertEpisodeId = undefined;
        this.triggeredByIncidentEpisode = undefined;
        this.triggeredByIncidentEpisodeId = undefined;
        this.status = undefined;
        this.statusMessage = undefined;
        this.userNotificationEventType = undefined;
        this.createdByUser = undefined;
        this.createdByUserId = undefined;
        this.deletedByUser = undefined;
        this.deletedByUserId = undefined;
        this.acknowledgedByUser = undefined;
        this.acknowledgedByUserId = undefined;
        this.acknowledgedAt = undefined;
        this.acknowledgedByTeam = undefined;
        this.acknowledgedByTeamId = undefined;
        this.lastExecutedEscalationRuleOrder = undefined;
        this.lastEscalationRuleExecutedAt = undefined;
        this.lastExecutedEscalationRule = undefined;
        this.lastExecutedEscalationRuleId = undefined;
        this.executeNextEscalationRuleInMinutes = undefined;
        this.onCallPolicyExecutionRepeatCount = undefined;
        this.triggeredByUser = undefined;
        this.triggeredByUserId = undefined;
    }
};
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.OnCallAdmin,
            Permission.OnCallMember,
            Permission.CreateProjectOnCallDutyPolicyExecutionLog,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.OnCallAdmin,
            Permission.OnCallMember,
            Permission.OnCallViewer,
            Permission.ReadProjectOnCallDutyPolicyExecutionLog,
        ],
        update: [],
    }),
    TableColumn({
        manyToOneRelationColumn: "projectId",
        type: TableColumnType.Entity,
        modelType: Project,
        title: "Project",
        description: "Relation to Project Resource in which this object belongs",
        example: "5f8b9c0d-e1a2-4b3c-8d5e-6f7a8b9c0d1e",
    }),
    ManyToOne(() => {
        return Project;
    }, {
        eager: false,
        nullable: true,
        onDelete: "CASCADE",
        orphanedRowAction: "nullify",
    }),
    JoinColumn({ name: "projectId" }),
    __metadata("design:type", Project)
], OnCallDutyPolicyExecutionLog.prototype, "project", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.OnCallAdmin,
            Permission.OnCallMember,
            Permission.CreateProjectOnCallDutyPolicyExecutionLog,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.OnCallAdmin,
            Permission.OnCallMember,
            Permission.OnCallViewer,
            Permission.ReadProjectOnCallDutyPolicyExecutionLog,
        ],
        update: [],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.ObjectID,
        required: true,
        canReadOnRelationQuery: true,
        title: "Project ID",
        description: "ID of your OneUptime Project in which this object belongs",
        example: "5f8b9c0d-e1a2-4b3c-8d5e-6f7a8b9c0d1e",
    }),
    Column({
        type: ColumnType.ObjectID,
        nullable: false,
        transformer: ObjectID.getDatabaseTransformer(),
    }),
    __metadata("design:type", ObjectID)
], OnCallDutyPolicyExecutionLog.prototype, "projectId", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.OnCallAdmin,
            Permission.OnCallMember,
            Permission.CreateProjectOnCallDutyPolicyExecutionLog,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.OnCallAdmin,
            Permission.OnCallMember,
            Permission.OnCallViewer,
            Permission.ReadProjectOnCallDutyPolicyExecutionLog,
        ],
        update: [],
    }),
    TableColumn({
        manyToOneRelationColumn: "onCallDutyPolicyId",
        type: TableColumnType.Entity,
        modelType: OnCallDutyPolicy,
        title: "On-Call Policy",
        description: "Relation to On-Call Policy which belongs to this execution log event.",
        example: "e5f6a7b8-c9d0-1234-ef01-345678901234",
    }),
    ManyToOne(() => {
        return OnCallDutyPolicy;
    }, {
        eager: false,
        nullable: true,
        onDelete: "CASCADE",
        orphanedRowAction: "nullify",
    }),
    JoinColumn({ name: "onCallDutyPolicyId" }),
    __metadata("design:type", OnCallDutyPolicy)
], OnCallDutyPolicyExecutionLog.prototype, "onCallDutyPolicy", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.OnCallAdmin,
            Permission.OnCallMember,
            Permission.CreateProjectOnCallDutyPolicyExecutionLog,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.OnCallAdmin,
            Permission.OnCallMember,
            Permission.OnCallViewer,
            Permission.ReadProjectOnCallDutyPolicyExecutionLog,
        ],
        update: [],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.ObjectID,
        required: true,
        canReadOnRelationQuery: true,
        title: "On-Call Policy ID",
        description: "ID of your On-Call Policy which belongs to this execution log event.",
        example: "e5f6a7b8-c9d0-1234-ef01-345678901234",
    }),
    Column({
        type: ColumnType.ObjectID,
        nullable: false,
        transformer: ObjectID.getDatabaseTransformer(),
    }),
    __metadata("design:type", ObjectID)
], OnCallDutyPolicyExecutionLog.prototype, "onCallDutyPolicyId", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.OnCallAdmin,
            Permission.OnCallMember,
            Permission.CreateProjectOnCallDutyPolicyExecutionLog,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.OnCallAdmin,
            Permission.OnCallMember,
            Permission.OnCallViewer,
            Permission.ReadProjectOnCallDutyPolicyExecutionLog,
        ],
        update: [],
    }),
    TableColumn({
        manyToOneRelationColumn: "triggeredByIncidentId",
        type: TableColumnType.Entity,
        modelType: Incident,
        title: "Triggered By Incident",
        description: "Relation to Incident which triggered this on-call duty policy.",
        example: "f6a7b8c9-d0e1-2345-f012-456789012345",
    }),
    ManyToOne(() => {
        return Incident;
    }, {
        eager: false,
        nullable: true,
        onDelete: "CASCADE",
        orphanedRowAction: "nullify",
    }),
    JoinColumn({ name: "triggeredByIncidentId" }),
    __metadata("design:type", Incident)
], OnCallDutyPolicyExecutionLog.prototype, "triggeredByIncident", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.OnCallAdmin,
            Permission.OnCallMember,
            Permission.CreateProjectOnCallDutyPolicyExecutionLog,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.OnCallAdmin,
            Permission.OnCallMember,
            Permission.OnCallViewer,
            Permission.ReadProjectOnCallDutyPolicyExecutionLog,
        ],
        update: [],
    }),
    TableColumn({
        type: TableColumnType.ObjectID,
        title: "Triggered By Incident ID",
        required: false,
        description: "ID of the incident which triggered this on-call escalation policy.",
        example: "f6a7b8c9-d0e1-2345-f012-456789012345",
    }),
    Column({
        type: ColumnType.ObjectID,
        nullable: true,
        transformer: ObjectID.getDatabaseTransformer(),
    }),
    __metadata("design:type", ObjectID)
], OnCallDutyPolicyExecutionLog.prototype, "triggeredByIncidentId", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.OnCallAdmin,
            Permission.OnCallMember,
            Permission.CreateProjectOnCallDutyPolicyExecutionLog,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.OnCallAdmin,
            Permission.OnCallMember,
            Permission.OnCallViewer,
            Permission.ReadProjectOnCallDutyPolicyExecutionLog,
        ],
        update: [],
    }),
    TableColumn({
        manyToOneRelationColumn: "triggeredByAlertId",
        type: TableColumnType.Entity,
        modelType: Alert,
        title: "Triggered By Alert",
        description: "Relation to Alert which triggered this on-call duty policy.",
        example: "a7b8c9d0-e1f2-3456-0123-567890123456",
    }),
    ManyToOne(() => {
        return Alert;
    }, {
        eager: false,
        nullable: true,
        onDelete: "CASCADE",
        orphanedRowAction: "nullify",
    }),
    JoinColumn({ name: "triggeredByAlertId" }),
    __metadata("design:type", Alert)
], OnCallDutyPolicyExecutionLog.prototype, "triggeredByAlert", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.OnCallAdmin,
            Permission.OnCallMember,
            Permission.CreateProjectOnCallDutyPolicyExecutionLog,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.OnCallAdmin,
            Permission.OnCallMember,
            Permission.OnCallViewer,
            Permission.ReadProjectOnCallDutyPolicyExecutionLog,
        ],
        update: [],
    }),
    TableColumn({
        type: TableColumnType.ObjectID,
        title: "Triggered By Alert ID",
        required: false,
        description: "ID of the incident which triggered this on-call escalation policy.",
        example: "a7b8c9d0-e1f2-3456-0123-567890123456",
    }),
    Column({
        type: ColumnType.ObjectID,
        nullable: true,
        transformer: ObjectID.getDatabaseTransformer(),
    }),
    __metadata("design:type", ObjectID)
], OnCallDutyPolicyExecutionLog.prototype, "triggeredByAlertId", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.OnCallAdmin,
            Permission.OnCallMember,
            Permission.CreateProjectOnCallDutyPolicyExecutionLog,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.OnCallAdmin,
            Permission.OnCallMember,
            Permission.OnCallViewer,
            Permission.ReadProjectOnCallDutyPolicyExecutionLog,
        ],
        update: [],
    }),
    TableColumn({
        manyToOneRelationColumn: "triggeredByAlertEpisodeId",
        type: TableColumnType.Entity,
        modelType: AlertEpisode,
        title: "Triggered By Alert Episode",
        description: "Relation to the alert episode which triggered this on-call escalation policy.",
    }),
    ManyToOne(() => {
        return AlertEpisode;
    }, {
        eager: false,
        nullable: true,
        onDelete: "CASCADE",
        orphanedRowAction: "nullify",
    }),
    JoinColumn({ name: "triggeredByAlertEpisodeId" }),
    __metadata("design:type", AlertEpisode)
], OnCallDutyPolicyExecutionLog.prototype, "triggeredByAlertEpisode", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.OnCallAdmin,
            Permission.OnCallMember,
            Permission.CreateProjectOnCallDutyPolicyExecutionLog,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.OnCallAdmin,
            Permission.OnCallMember,
            Permission.OnCallViewer,
            Permission.ReadProjectOnCallDutyPolicyExecutionLog,
        ],
        update: [],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.ObjectID,
        required: false,
        canReadOnRelationQuery: true,
        title: "Triggered By Alert Episode ID",
        description: "ID of the alert episode which triggered this on-call escalation policy.",
        example: "a7b8c9d0-e1f2-3456-0123-567890123456",
    }),
    Column({
        type: ColumnType.ObjectID,
        nullable: true,
        transformer: ObjectID.getDatabaseTransformer(),
    }),
    __metadata("design:type", ObjectID)
], OnCallDutyPolicyExecutionLog.prototype, "triggeredByAlertEpisodeId", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.OnCallAdmin,
            Permission.OnCallMember,
            Permission.CreateProjectOnCallDutyPolicyExecutionLog,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.OnCallAdmin,
            Permission.OnCallMember,
            Permission.OnCallViewer,
            Permission.ReadProjectOnCallDutyPolicyExecutionLog,
        ],
        update: [],
    }),
    TableColumn({
        manyToOneRelationColumn: "triggeredByIncidentEpisodeId",
        type: TableColumnType.Entity,
        modelType: IncidentEpisode,
        title: "Triggered By Incident Episode",
        description: "Relation to the incident episode which triggered this on-call escalation policy.",
    }),
    ManyToOne(() => {
        return IncidentEpisode;
    }, {
        eager: false,
        nullable: true,
        onDelete: "CASCADE",
        orphanedRowAction: "nullify",
    }),
    JoinColumn({ name: "triggeredByIncidentEpisodeId" }),
    __metadata("design:type", IncidentEpisode)
], OnCallDutyPolicyExecutionLog.prototype, "triggeredByIncidentEpisode", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.OnCallAdmin,
            Permission.OnCallMember,
            Permission.CreateProjectOnCallDutyPolicyExecutionLog,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.OnCallAdmin,
            Permission.OnCallMember,
            Permission.OnCallViewer,
            Permission.ReadProjectOnCallDutyPolicyExecutionLog,
        ],
        update: [],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.ObjectID,
        required: false,
        canReadOnRelationQuery: true,
        title: "Triggered By Incident Episode ID",
        description: "ID of the incident episode which triggered this on-call escalation policy.",
        example: "a7b8c9d0-e1f2-3456-0123-567890123456",
    }),
    Column({
        type: ColumnType.ObjectID,
        nullable: true,
        transformer: ObjectID.getDatabaseTransformer(),
    }),
    __metadata("design:type", ObjectID)
], OnCallDutyPolicyExecutionLog.prototype, "triggeredByIncidentEpisodeId", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.OnCallAdmin,
            Permission.OnCallMember,
            Permission.CreateProjectOnCallDutyPolicyExecutionLog,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.OnCallAdmin,
            Permission.OnCallMember,
            Permission.OnCallViewer,
            Permission.ReadProjectOnCallDutyPolicyExecutionLog,
        ],
        update: [],
    }),
    TableColumn({
        required: true,
        type: TableColumnType.ShortText,
        title: "Status",
        description: "Status of this execution",
        canReadOnRelationQuery: false,
        example: "Executing",
    }),
    Column({
        nullable: false,
        type: ColumnType.ShortText,
        length: ColumnLength.ShortText,
    }),
    __metadata("design:type", String)
], OnCallDutyPolicyExecutionLog.prototype, "status", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.OnCallAdmin,
            Permission.OnCallMember,
            Permission.CreateProjectOnCallDutyPolicyExecutionLog,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.OnCallAdmin,
            Permission.OnCallMember,
            Permission.OnCallViewer,
            Permission.ReadProjectOnCallDutyPolicyExecutionLog,
        ],
        update: [],
    }),
    TableColumn({
        required: true,
        type: TableColumnType.LongText,
        title: "Status Message",
        description: "Status message of this execution",
        canReadOnRelationQuery: false,
        example: "On-call policy execution started. Notifying primary on-call team members.",
    }),
    Column({
        nullable: false,
        type: ColumnType.LongText,
        length: ColumnLength.LongText,
    }),
    __metadata("design:type", String)
], OnCallDutyPolicyExecutionLog.prototype, "statusMessage", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.OnCallAdmin,
            Permission.OnCallMember,
            Permission.CreateProjectOnCallDutyPolicyExecutionLog,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.OnCallAdmin,
            Permission.OnCallMember,
            Permission.OnCallViewer,
            Permission.ReadProjectOnCallDutyPolicyExecutionLog,
        ],
        update: [],
    }),
    TableColumn({
        required: true,
        type: TableColumnType.ShortText,
        title: "Notification Event Type",
        description: "Type of event that triggered this on-call duty policy.",
        canReadOnRelationQuery: false,
        example: "IncidentCreated",
    }),
    Column({
        nullable: false,
        type: ColumnType.ShortText,
        length: ColumnLength.ShortText,
    }),
    __metadata("design:type", String)
], OnCallDutyPolicyExecutionLog.prototype, "userNotificationEventType", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.OnCallAdmin,
            Permission.OnCallMember,
            Permission.CreateProjectOnCallDutyPolicyExecutionLog,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.OnCallAdmin,
            Permission.OnCallMember,
            Permission.OnCallViewer,
            Permission.ReadProjectOnCallDutyPolicyExecutionLog,
        ],
        update: [],
    }),
    TableColumn({
        manyToOneRelationColumn: "createdByUserId",
        type: TableColumnType.Entity,
        modelType: User,
        title: "Created by User",
        description: "Relation to User who created this object (if this object was created by a User)",
        example: "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    }),
    ManyToOne(() => {
        return User;
    }, {
        eager: false,
        nullable: true,
        onDelete: "SET NULL",
        orphanedRowAction: "nullify",
    }),
    JoinColumn({ name: "createdByUserId" }),
    __metadata("design:type", User)
], OnCallDutyPolicyExecutionLog.prototype, "createdByUser", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.OnCallAdmin,
            Permission.OnCallMember,
            Permission.CreateProjectOnCallDutyPolicyExecutionLog,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.OnCallAdmin,
            Permission.OnCallMember,
            Permission.OnCallViewer,
            Permission.ReadProjectOnCallDutyPolicyExecutionLog,
        ],
        update: [],
    }),
    TableColumn({
        type: TableColumnType.ObjectID,
        title: "Created by User ID",
        description: "User ID who created this object (if this object was created by a User)",
        example: "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    }),
    Column({
        type: ColumnType.ObjectID,
        nullable: true,
        transformer: ObjectID.getDatabaseTransformer(),
    }),
    __metadata("design:type", ObjectID)
], OnCallDutyPolicyExecutionLog.prototype, "createdByUserId", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.OnCallAdmin,
            Permission.OnCallMember,
            Permission.CreateProjectOnCallDutyPolicyExecutionLog,
        ],
        read: [],
        update: [],
    }),
    TableColumn({
        manyToOneRelationColumn: "deletedByUserId",
        type: TableColumnType.Entity,
        title: "Deleted by User",
        modelType: User,
        description: "Relation to User who deleted this object (if this object was deleted by a User)",
        example: "b2c3d4e5-f6a7-8901-bcde-f12345678901",
    }),
    ManyToOne(() => {
        return User;
    }, {
        cascade: false,
        eager: false,
        nullable: true,
        onDelete: "SET NULL",
        orphanedRowAction: "nullify",
    }),
    JoinColumn({ name: "deletedByUserId" }),
    __metadata("design:type", User)
], OnCallDutyPolicyExecutionLog.prototype, "deletedByUser", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.OnCallAdmin,
            Permission.OnCallMember,
            Permission.CreateProjectOnCallDutyPolicyExecutionLog,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.OnCallAdmin,
            Permission.OnCallMember,
            Permission.OnCallViewer,
            Permission.ReadProjectOnCallDutyPolicyExecutionLog,
        ],
        update: [],
    }),
    TableColumn({
        type: TableColumnType.ObjectID,
        title: "Deleted by User ID",
        description: "User ID who deleted this object (if this object was deleted by a User)",
        example: "b2c3d4e5-f6a7-8901-bcde-f12345678901",
    }),
    Column({
        type: ColumnType.ObjectID,
        nullable: true,
        transformer: ObjectID.getDatabaseTransformer(),
    }),
    __metadata("design:type", ObjectID)
], OnCallDutyPolicyExecutionLog.prototype, "deletedByUserId", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.OnCallAdmin,
            Permission.OnCallMember,
            Permission.CreateProjectOnCallDutyPolicyExecutionLog,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.OnCallAdmin,
            Permission.OnCallMember,
            Permission.OnCallViewer,
            Permission.ReadProjectOnCallDutyPolicyExecutionLog,
        ],
        update: [],
    }),
    TableColumn({
        manyToOneRelationColumn: "acknowledgedByUserId",
        type: TableColumnType.Entity,
        modelType: User,
        title: "Acknowledged by User",
        description: "Relation to User who acknowledged this policy execution (if this policy was acknowledged by a User)",
        example: "c3d4e5f6-a7b8-9012-cdef-123456789012",
    }),
    ManyToOne(() => {
        return User;
    }, {
        cascade: false,
        eager: false,
        nullable: true,
        onDelete: "CASCADE",
        orphanedRowAction: "nullify",
    }),
    JoinColumn({ name: "acknowledgedByUserId" }),
    __metadata("design:type", User)
], OnCallDutyPolicyExecutionLog.prototype, "acknowledgedByUser", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.OnCallAdmin,
            Permission.OnCallMember,
            Permission.CreateProjectOnCallDutyPolicyExecutionLog,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.OnCallAdmin,
            Permission.OnCallMember,
            Permission.OnCallViewer,
            Permission.ReadProjectOnCallDutyPolicyExecutionLog,
        ],
        update: [],
    }),
    TableColumn({
        type: TableColumnType.ObjectID,
        title: "Acknowledged by User ID",
        description: "User ID who acknowledged this object (if this object was acknowledged by a User)",
        example: "c3d4e5f6-a7b8-9012-cdef-123456789012",
    }),
    Column({
        type: ColumnType.ObjectID,
        nullable: true,
        transformer: ObjectID.getDatabaseTransformer(),
    }),
    __metadata("design:type", ObjectID)
], OnCallDutyPolicyExecutionLog.prototype, "acknowledgedByUserId", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.OnCallAdmin,
            Permission.OnCallMember,
            Permission.CreateProjectOnCallDutyPolicyExecutionLog,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.OnCallAdmin,
            Permission.OnCallMember,
            Permission.OnCallViewer,
            Permission.ReadProjectOnCallDutyPolicyExecutionLog,
        ],
        update: [],
    }),
    TableColumn({
        type: TableColumnType.Date,
        title: "Acknowledged At",
        description: "When was this policy execution acknowledged?",
        example: "2024-01-15T10:45:00.000Z",
    }),
    Column({
        type: ColumnType.Date,
        nullable: true,
        unique: false,
    }),
    __metadata("design:type", Date)
], OnCallDutyPolicyExecutionLog.prototype, "acknowledgedAt", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.OnCallAdmin,
            Permission.OnCallMember,
            Permission.CreateProjectOnCallDutyPolicyExecutionLog,
        ],
        read: [],
        update: [],
    }),
    TableColumn({
        manyToOneRelationColumn: "acknowledgedByTeamId",
        type: TableColumnType.Entity,
        title: "Acknowledged by Team",
        description: "Relation to Team who acknowledged this policy execution (if this policy was acknowledged by a Team)",
        example: "d4e5f6a7-b8c9-0123-def0-234567890123",
    }),
    ManyToOne(() => {
        return Team;
    }, {
        cascade: false,
        eager: false,
        nullable: true,
        onDelete: "CASCADE",
        orphanedRowAction: "nullify",
    }),
    JoinColumn({ name: "acknowledgedByTeamId" }),
    __metadata("design:type", Team)
], OnCallDutyPolicyExecutionLog.prototype, "acknowledgedByTeam", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.OnCallAdmin,
            Permission.OnCallMember,
            Permission.CreateProjectOnCallDutyPolicyExecutionLog,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.OnCallAdmin,
            Permission.OnCallMember,
            Permission.OnCallViewer,
            Permission.ReadProjectOnCallDutyPolicyExecutionLog,
        ],
        update: [],
    }),
    TableColumn({
        type: TableColumnType.ObjectID,
        title: "Acknowledged by Team ID",
        description: "Team ID who acknowledged this object (if this object was acknowledged by a Team)",
        example: "d4e5f6a7-b8c9-0123-def0-234567890123",
    }),
    Column({
        type: ColumnType.ObjectID,
        nullable: true,
        transformer: ObjectID.getDatabaseTransformer(),
    }),
    __metadata("design:type", ObjectID)
], OnCallDutyPolicyExecutionLog.prototype, "acknowledgedByTeamId", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.OnCallAdmin,
            Permission.OnCallMember,
            Permission.CreateProjectOnCallDutyPolicyExecutionLog,
        ],
        read: [],
        update: [],
    }),
    Index(),
    TableColumn({
        required: false,
        type: TableColumnType.Number,
        title: "Executed Escalation Rule Order",
        description: "Which escalation rule was executed?",
        canReadOnRelationQuery: true,
        example: 2,
    }),
    Column({
        nullable: true,
        type: ColumnType.Number,
    }),
    __metadata("design:type", Number)
], OnCallDutyPolicyExecutionLog.prototype, "lastExecutedEscalationRuleOrder", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.OnCallAdmin,
            Permission.OnCallMember,
            Permission.CreateProjectOnCallDutyPolicyExecutionLog,
        ],
        read: [],
        update: [],
    }),
    Index(),
    TableColumn({
        required: false,
        type: TableColumnType.Date,
        title: "Last Escalation Rule Executed At",
        description: "When was the escalation rule executed?",
        canReadOnRelationQuery: true,
        example: "2024-01-15T10:30:00.000Z",
    }),
    Column({
        nullable: true,
        type: ColumnType.Date,
    }),
    __metadata("design:type", Date)
], OnCallDutyPolicyExecutionLog.prototype, "lastEscalationRuleExecutedAt", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.OnCallAdmin,
            Permission.OnCallMember,
            Permission.CreateProjectOnCallDutyPolicyExecutionLog,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.OnCallAdmin,
            Permission.OnCallMember,
            Permission.OnCallViewer,
            Permission.ReadProjectOnCallDutyPolicyExecutionLogTimeline,
        ],
        update: [],
    }),
    TableColumn({
        manyToOneRelationColumn: "lastExecutedEscalationRuleId",
        type: TableColumnType.Entity,
        modelType: OnCallDutyPolicyEscalationRule,
        title: "Last Executed Escalation Rule",
        description: "Relation to On-Call Policy Last Executed Escalation Rule.",
        example: "e5f6a7b8-c9d0-1234-ef01-345678901234",
    }),
    ManyToOne(() => {
        return OnCallDutyPolicyEscalationRule;
    }, {
        eager: false,
        nullable: true,
        onDelete: "CASCADE",
        orphanedRowAction: "nullify",
    }),
    JoinColumn({ name: "lastExecutedEscalationRuleId" }),
    __metadata("design:type", OnCallDutyPolicyEscalationRule)
], OnCallDutyPolicyExecutionLog.prototype, "lastExecutedEscalationRule", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.OnCallAdmin,
            Permission.OnCallMember,
            Permission.CreateProjectOnCallDutyPolicyExecutionLog,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.OnCallAdmin,
            Permission.OnCallMember,
            Permission.OnCallViewer,
            Permission.ReadProjectOnCallDutyPolicyExecutionLogTimeline,
        ],
        update: [],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.ObjectID,
        required: false,
        canReadOnRelationQuery: true,
        title: "Last Executed Escalation Rule ID",
        description: "ID of your On-Call Policy Last Executed Escalation Rule.",
        example: "e5f6a7b8-c9d0-1234-ef01-345678901234",
    }),
    Column({
        type: ColumnType.ObjectID,
        nullable: true,
        transformer: ObjectID.getDatabaseTransformer(),
    }),
    __metadata("design:type", ObjectID)
], OnCallDutyPolicyExecutionLog.prototype, "lastExecutedEscalationRuleId", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.OnCallAdmin,
            Permission.OnCallMember,
            Permission.CreateProjectOnCallDutyPolicyExecutionLog,
        ],
        read: [],
        update: [],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.Number,
        required: false,
        canReadOnRelationQuery: true,
        title: "Execute next escalation rule in minutes",
        description: "How many minutes should we wait before executing the next escalation rule?",
        example: 15,
    }),
    Column({
        type: ColumnType.Number,
        nullable: true,
    }),
    __metadata("design:type", Number)
], OnCallDutyPolicyExecutionLog.prototype, "executeNextEscalationRuleInMinutes", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.OnCallAdmin,
            Permission.OnCallMember,
            Permission.CreateProjectOnCallDutyPolicyExecutionLog,
        ],
        read: [],
        update: [],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.Number,
        required: true,
        isDefaultValueColumn: true,
        canReadOnRelationQuery: true,
        title: "On-Call Policy Execution Repeat Count",
        description: "How many times did we execute this on-call policy?",
        defaultValue: 1,
        example: 3,
    }),
    Column({
        type: ColumnType.Number,
        nullable: false,
        default: 1,
    }),
    __metadata("design:type", Number)
], OnCallDutyPolicyExecutionLog.prototype, "onCallPolicyExecutionRepeatCount", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.OnCallAdmin,
            Permission.OnCallMember,
            Permission.CreateProjectOnCallDutyPolicyExecutionLog,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.OnCallAdmin,
            Permission.OnCallMember,
            Permission.OnCallViewer,
            Permission.ReadProjectOnCallDutyPolicyExecutionLog,
        ],
        update: [],
    }),
    TableColumn({
        manyToOneRelationColumn: "triggeredByUserId",
        type: TableColumnType.Entity,
        modelType: User,
        title: "Triggered by User",
        description: "Relation to User who triggered on-clal policy",
        example: "f6a7b8c9-d0e1-2345-f012-456789012345",
    }),
    ManyToOne(() => {
        return User;
    }, {
        eager: false,
        nullable: true,
        onDelete: "SET NULL",
        orphanedRowAction: "nullify",
    }),
    JoinColumn({ name: "triggeredByUserId" }),
    __metadata("design:type", User)
], OnCallDutyPolicyExecutionLog.prototype, "triggeredByUser", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.OnCallAdmin,
            Permission.OnCallMember,
            Permission.CreateProjectOnCallDutyPolicyExecutionLog,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.OnCallAdmin,
            Permission.OnCallMember,
            Permission.OnCallViewer,
            Permission.ReadProjectOnCallDutyPolicyExecutionLog,
        ],
        update: [],
    }),
    TableColumn({
        type: TableColumnType.ObjectID,
        title: "Triggered by User ID",
        description: "User ID who triggered this on-call policy",
        example: "f6a7b8c9-d0e1-2345-f012-456789012345",
    }),
    Column({
        type: ColumnType.ObjectID,
        nullable: true,
        transformer: ObjectID.getDatabaseTransformer(),
    }),
    __metadata("design:type", ObjectID)
], OnCallDutyPolicyExecutionLog.prototype, "triggeredByUserId", void 0);
OnCallDutyPolicyExecutionLog = __decorate([
    TableBillingAccessControl({
        create: PlanType.Growth,
        read: PlanType.Growth,
        update: PlanType.Growth,
        delete: PlanType.Growth,
    }),
    EnableWorkflow({
        create: true,
        delete: true,
        update: true,
        read: true,
    }),
    EnableDocumentation(),
    CanAccessIfCanReadOn("onCallDutyPolicy"),
    TenantColumn("projectId"),
    TableAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.OnCallAdmin,
            Permission.OnCallMember,
            Permission.CreateProjectOnCallDutyPolicyExecutionLog,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.OnCallAdmin,
            Permission.OnCallMember,
            Permission.OnCallViewer,
            Permission.ReadProjectOnCallDutyPolicyExecutionLog,
        ],
        delete: [],
        update: [],
    }),
    CrudApiEndpoint(new Route("/on-call-duty-policy-execution-log")),
    OwnedThrough("onCallDutyPolicyId", OnCallDutyPolicy),
    Entity({
        name: "OnCallDutyPolicyExecutionLog",
    }),
    TableMetadata({
        tableName: "OnCallDutyPolicyExecutionLog",
        singularName: "On-Call Duty Execution Log",
        pluralName: "On-Call Duty Execution Log",
        icon: IconProp.Call,
        tableDescription: "Logs for on-call duty policy execution.",
    })
], OnCallDutyPolicyExecutionLog);
export default OnCallDutyPolicyExecutionLog;
//# sourceMappingURL=OnCallDutyPolicyExecutionLog.js.map