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 DockerHost from "./DockerHost";
import DockerResource from "./DockerResource";
import Host from "./Host";
import IncidentEpisode from "./IncidentEpisode";
import IncidentSeverity from "./IncidentSeverity";
import IncidentState from "./IncidentState";
import KubernetesCluster from "./KubernetesCluster";
import KubernetesContainer from "./KubernetesContainer";
import KubernetesResource from "./KubernetesResource";
import Label from "./Label";
import Monitor from "./Monitor";
import MonitorStatus from "./MonitorStatus";
import OnCallDutyPolicy from "./OnCallDutyPolicy";
import Probe from "./Probe";
import Project from "./Project";
import Service from "./Service";
import User from "./User";
import File from "./File";
import BaseModel from "./DatabaseBaseModel/DatabaseBaseModel";
import Route from "../../Types/API/Route";
import ColumnAccessControl from "../../Types/Database/AccessControl/ColumnAccessControl";
import OperationalResource from "../../Types/Database/AccessControl/OperationalResource";
import TableAccessControl from "../../Types/Database/AccessControl/TableAccessControl";
import AccessControlColumn from "../../Types/Database/AccessControlColumn";
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 EnableMCP from "../../Types/Database/EnableMCP";
import EnableAuditLog from "../../Types/Database/EnableAuditLog";
import EnableWorkflow from "../../Types/Database/EnableWorkflow";
import MultiTenentQueryAllowed from "../../Types/Database/MultiTenentQueryAllowed";
import SlugifyColumn from "../../Types/Database/SlugifyColumn";
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 Permission from "../../Types/Permission";
import StatusPageSubscriberNotificationStatus from "../../Types/StatusPage/StatusPageSubscriberNotificationStatus";
import { Column, Entity, Index, JoinColumn, JoinTable, ManyToMany, ManyToOne, } from "typeorm";
let Incident = class Incident extends BaseModel {
    constructor() {
        super(...arguments);
        this.project = undefined;
        this.projectId = undefined;
        this.title = undefined;
        this.description = undefined;
        this.declaredAt = undefined;
        this.slug = undefined;
        this.createdByUser = undefined;
        this.createdByUserId = undefined;
        this.deletedByUser = undefined;
        this.deletedByUserId = undefined;
        this.monitors = undefined; // monitors affected by this incident.
        this.hosts = undefined; // hosts affected by this incident.
        this.kubernetesClusters = undefined;
        this.kubernetesResources = undefined;
        this.kubernetesContainers = undefined;
        this.dockerHosts = undefined;
        this.dockerResources = undefined;
        this.services = undefined;
        this.onCallDutyPolicies = undefined; // on-call duty policies affected by this incident.
        this.labels = undefined;
        this.currentIncidentState = undefined;
        this.currentIncidentStateId = undefined;
        this.incidentSeverity = undefined;
        this.incidentSeverityId = undefined;
        this.changeMonitorStatusTo = undefined;
        this.changeMonitorStatusToId = undefined;
        this.subscriberNotificationStatusOnIncidentCreated = undefined;
        this.subscriberNotificationStatusMessage = undefined;
        this.subscriberNotificationStatusOnPostmortemPublished = undefined;
        this.subscriberNotificationStatusMessageOnPostmortemPublished = undefined;
        this.shouldStatusPageSubscribersBeNotifiedOnIncidentCreated = undefined;
        this.customFields = undefined;
        this.isOwnerNotifiedOfResourceCreation = undefined;
        this.rootCause = undefined;
        this.postmortemNote = undefined;
        this.showPostmortemOnStatusPage = undefined;
        this.notifySubscribersOnPostmortemPublished = undefined;
        this.postmortemPostedAt = undefined;
        this.postmortemAttachments = undefined;
        this.createdStateLog = undefined;
        this.createdCriteriaId = undefined;
        this.createdIncidentTemplateId = undefined;
        this.seriesFingerprint = undefined;
        this.seriesLabels = undefined;
        this.createdByProbe = undefined;
        this.createdByProbeId = undefined;
        this.isCreatedAutomatically = undefined;
        this.remediationNotes = undefined;
        this.telemetryQuery = undefined;
        this.incidentNumber = undefined;
        this.incidentNumberWithPrefix = undefined;
        this.postUpdatesToWorkspaceChannels = undefined;
        this.isVisibleOnStatusPage = undefined;
        this.isPrivate = undefined;
        this.incidentEpisode = undefined;
        this.incidentEpisodeId = undefined;
    }
};
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateProjectIncident,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadProjectIncident,
        ],
        update: [],
    }),
    TableColumn({
        manyToOneRelationColumn: "projectId",
        type: TableColumnType.Entity,
        modelType: Project,
        title: "Project",
        description: "Relation to Project Resource in which this object belongs",
    }),
    ManyToOne(() => {
        return Project;
    }, {
        eager: false,
        nullable: true,
        onDelete: "CASCADE",
        orphanedRowAction: "nullify",
    }),
    JoinColumn({ name: "projectId" }),
    __metadata("design:type", Project)
], Incident.prototype, "project", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateProjectIncident,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadProjectIncident,
        ],
        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)
], Incident.prototype, "projectId", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateProjectIncident,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadProjectIncident,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.EditProjectIncident,
        ],
    }),
    Index(),
    TableColumn({
        required: true,
        type: TableColumnType.LongText,
        canReadOnRelationQuery: true,
        title: "Title",
        description: "Title of this incident",
        example: "Database connection failure in production",
    }),
    Column({
        nullable: false,
        type: ColumnType.LongText,
        length: ColumnLength.LongText,
    }),
    __metadata("design:type", String)
], Incident.prototype, "title", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateProjectIncident,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadProjectIncident,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.EditProjectIncident,
        ],
    }),
    TableColumn({
        required: false,
        type: TableColumnType.Markdown,
        title: "Description",
        description: "Short description of this incident. This is in markdown and will be visible on the status page.",
        example: "Our engineering team is investigating database connectivity issues affecting the main production cluster.",
    }),
    Column({
        nullable: true,
        type: ColumnType.Markdown,
    }),
    __metadata("design:type", String)
], Incident.prototype, "description", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateProjectIncident,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadProjectIncident,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.EditProjectIncident,
        ],
    }),
    Index(),
    TableColumn({
        required: true,
        type: TableColumnType.Date,
        title: "Declared At",
        description: "Date and time when this incident was declared.",
        isDefaultValueColumn: true,
        example: "2024-01-15T09:30:00.000Z",
    }),
    Column({
        type: ColumnType.Date,
        nullable: false,
        default: () => {
            return "now()";
        },
    }),
    __metadata("design:type", Date)
], Incident.prototype, "declaredAt", void 0);
__decorate([
    Index(),
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadProjectIncident,
        ],
        update: [],
    }),
    TableColumn({
        required: true,
        unique: true,
        type: TableColumnType.Slug,
        computed: true,
        title: "Slug",
        description: "Friendly globally unique name for your object",
        example: "database-connection-failure-in-production",
    }),
    Column({
        nullable: false,
        type: ColumnType.Slug,
        length: ColumnLength.Slug,
        unique: true,
    }),
    __metadata("design:type", String)
], Incident.prototype, "slug", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateProjectIncident,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadProjectIncident,
        ],
        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)",
    }),
    ManyToOne(() => {
        return User;
    }, {
        eager: false,
        nullable: true,
        onDelete: "SET NULL",
        orphanedRowAction: "nullify",
    }),
    JoinColumn({ name: "createdByUserId" }),
    __metadata("design:type", User)
], Incident.prototype, "createdByUser", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateProjectIncident,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadProjectIncident,
        ],
        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)",
    }),
    Column({
        type: ColumnType.ObjectID,
        nullable: true,
        transformer: ObjectID.getDatabaseTransformer(),
    }),
    __metadata("design:type", ObjectID)
], Incident.prototype, "createdByUserId", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        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)",
    }),
    ManyToOne(() => {
        return User;
    }, {
        cascade: false,
        eager: false,
        nullable: true,
        onDelete: "SET NULL",
        orphanedRowAction: "nullify",
    }),
    JoinColumn({ name: "deletedByUserId" }),
    __metadata("design:type", User)
], Incident.prototype, "deletedByUser", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [],
        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)",
    }),
    Column({
        type: ColumnType.ObjectID,
        nullable: true,
        transformer: ObjectID.getDatabaseTransformer(),
    }),
    __metadata("design:type", ObjectID)
], Incident.prototype, "deletedByUserId", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateProjectIncident,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadProjectIncident,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.EditProjectIncident,
        ],
    }),
    TableColumn({
        required: false,
        type: TableColumnType.EntityArray,
        modelType: Monitor,
        title: "Monitors",
        description: "List of monitors affected by this incident",
    }),
    ManyToMany(() => {
        return Monitor;
    }, { eager: false }),
    JoinTable({
        name: "IncidentMonitor",
        inverseJoinColumn: {
            name: "monitorId",
            referencedColumnName: "_id",
        },
        joinColumn: {
            name: "incidentId",
            referencedColumnName: "_id",
        },
    }),
    __metadata("design:type", Array)
], Incident.prototype, "monitors", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateProjectIncident,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadProjectIncident,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.EditProjectIncident,
        ],
    }),
    TableColumn({
        required: false,
        type: TableColumnType.EntityArray,
        modelType: Host,
        title: "Hosts",
        description: "List of hosts affected by this incident.",
    }),
    ManyToMany(() => {
        return Host;
    }, { eager: false }),
    JoinTable({
        name: "IncidentHost",
        inverseJoinColumn: {
            name: "hostId",
            referencedColumnName: "_id",
        },
        joinColumn: {
            name: "incidentId",
            referencedColumnName: "_id",
        },
    }),
    __metadata("design:type", Array)
], Incident.prototype, "hosts", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateProjectIncident,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadProjectIncident,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.EditProjectIncident,
        ],
    }),
    TableColumn({
        required: false,
        type: TableColumnType.EntityArray,
        modelType: KubernetesCluster,
        title: "Kubernetes Clusters",
        description: "List of Kubernetes clusters affected by this incident.",
    }),
    ManyToMany(() => {
        return KubernetesCluster;
    }, { eager: false }),
    JoinTable({
        name: "IncidentKubernetesCluster",
        inverseJoinColumn: {
            name: "kubernetesClusterId",
            referencedColumnName: "_id",
        },
        joinColumn: {
            name: "incidentId",
            referencedColumnName: "_id",
        },
    }),
    __metadata("design:type", Array)
], Incident.prototype, "kubernetesClusters", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateProjectIncident,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadProjectIncident,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.EditProjectIncident,
        ],
    }),
    TableColumn({
        required: false,
        type: TableColumnType.EntityArray,
        modelType: KubernetesResource,
        title: "Kubernetes Resources",
        description: "List of Kubernetes resources (pods, deployments, nodes, etc.) affected by this incident.",
    }),
    ManyToMany(() => {
        return KubernetesResource;
    }, { eager: false }),
    JoinTable({
        name: "IncidentKubernetesResource",
        inverseJoinColumn: {
            name: "kubernetesResourceId",
            referencedColumnName: "_id",
        },
        joinColumn: {
            name: "incidentId",
            referencedColumnName: "_id",
        },
    }),
    __metadata("design:type", Array)
], Incident.prototype, "kubernetesResources", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateProjectIncident,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadProjectIncident,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.EditProjectIncident,
        ],
    }),
    TableColumn({
        required: false,
        type: TableColumnType.EntityArray,
        modelType: KubernetesContainer,
        title: "Kubernetes Containers",
        description: "List of Kubernetes containers affected by this incident.",
    }),
    ManyToMany(() => {
        return KubernetesContainer;
    }, { eager: false }),
    JoinTable({
        name: "IncidentKubernetesContainer",
        inverseJoinColumn: {
            name: "kubernetesContainerId",
            referencedColumnName: "_id",
        },
        joinColumn: {
            name: "incidentId",
            referencedColumnName: "_id",
        },
    }),
    __metadata("design:type", Array)
], Incident.prototype, "kubernetesContainers", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateProjectIncident,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadProjectIncident,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.EditProjectIncident,
        ],
    }),
    TableColumn({
        required: false,
        type: TableColumnType.EntityArray,
        modelType: DockerHost,
        title: "Docker Hosts",
        description: "List of Docker hosts affected by this incident.",
    }),
    ManyToMany(() => {
        return DockerHost;
    }, { eager: false }),
    JoinTable({
        name: "IncidentDockerHost",
        inverseJoinColumn: {
            name: "dockerHostId",
            referencedColumnName: "_id",
        },
        joinColumn: {
            name: "incidentId",
            referencedColumnName: "_id",
        },
    }),
    __metadata("design:type", Array)
], Incident.prototype, "dockerHosts", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateProjectIncident,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadProjectIncident,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.EditProjectIncident,
        ],
    }),
    TableColumn({
        required: false,
        type: TableColumnType.EntityArray,
        modelType: DockerResource,
        title: "Docker Resources",
        description: "List of Docker resources (containers, images, networks, volumes) affected by this incident.",
    }),
    ManyToMany(() => {
        return DockerResource;
    }, { eager: false }),
    JoinTable({
        name: "IncidentDockerResource",
        inverseJoinColumn: {
            name: "dockerResourceId",
            referencedColumnName: "_id",
        },
        joinColumn: {
            name: "incidentId",
            referencedColumnName: "_id",
        },
    }),
    __metadata("design:type", Array)
], Incident.prototype, "dockerResources", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateProjectIncident,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadProjectIncident,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.EditProjectIncident,
        ],
    }),
    TableColumn({
        required: false,
        type: TableColumnType.EntityArray,
        modelType: Service,
        title: "Services",
        description: "List of services affected by this incident.",
    }),
    ManyToMany(() => {
        return Service;
    }, { eager: false }),
    JoinTable({
        name: "IncidentService",
        inverseJoinColumn: {
            name: "serviceId",
            referencedColumnName: "_id",
        },
        joinColumn: {
            name: "incidentId",
            referencedColumnName: "_id",
        },
    }),
    __metadata("design:type", Array)
], Incident.prototype, "services", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateProjectIncident,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadProjectIncident,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.EditProjectIncident,
        ],
    }),
    TableColumn({
        required: false,
        type: TableColumnType.EntityArray,
        modelType: OnCallDutyPolicy,
        title: "On-Call Duty Policies",
        description: "List of on-call duty policies affected by this incident.",
    }),
    ManyToMany(() => {
        return OnCallDutyPolicy;
    }, { eager: false }),
    JoinTable({
        name: "IncidentOnCallDutyPolicy",
        inverseJoinColumn: {
            name: "onCallDutyPolicyId",
            referencedColumnName: "_id",
        },
        joinColumn: {
            name: "incidentId",
            referencedColumnName: "_id",
        },
    }),
    __metadata("design:type", Array)
], Incident.prototype, "onCallDutyPolicies", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateProjectIncident,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadProjectIncident,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.EditProjectIncident,
        ],
    }),
    TableColumn({
        required: false,
        type: TableColumnType.EntityArray,
        modelType: Label,
        title: "Labels",
        description: "Relation to Labels Array where this object is categorized in.",
    }),
    ManyToMany(() => {
        return Label;
    }, { eager: false }),
    JoinTable({
        name: "IncidentLabel",
        inverseJoinColumn: {
            name: "labelId",
            referencedColumnName: "_id",
        },
        joinColumn: {
            name: "incidentId",
            referencedColumnName: "_id",
        },
    }),
    __metadata("design:type", Array)
], Incident.prototype, "labels", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateProjectIncident,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadProjectIncident,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.EditProjectIncident,
        ],
    }),
    TableColumn({
        manyToOneRelationColumn: "currentIncidentStateId",
        type: TableColumnType.Entity,
        computed: true,
        modelType: IncidentState,
        title: "Current Incident State",
        description: "Current state of this incident. Is the incident acknowledged? or resolved?. This is related to Incident State",
    }),
    ManyToOne(() => {
        return IncidentState;
    }, {
        eager: false,
        nullable: true,
        orphanedRowAction: "nullify",
    }),
    JoinColumn({ name: "currentIncidentStateId" }),
    __metadata("design:type", IncidentState)
], Incident.prototype, "currentIncidentState", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateProjectIncident,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadProjectIncident,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.EditProjectIncident,
        ],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.ObjectID,
        isDefaultValueColumn: true,
        required: true,
        canReadOnRelationQuery: true,
        title: "Current Incident State ID",
        description: "Current Incident State ID",
        example: "d4e5f6a7-b8c9-0123-defg-456789012345",
    }),
    Column({
        type: ColumnType.ObjectID,
        nullable: false,
        transformer: ObjectID.getDatabaseTransformer(),
    }),
    __metadata("design:type", ObjectID)
], Incident.prototype, "currentIncidentStateId", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateProjectIncident,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadProjectIncident,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.EditProjectIncident,
        ],
    }),
    TableColumn({
        manyToOneRelationColumn: "incidentSeverityId",
        type: TableColumnType.Entity,
        modelType: IncidentSeverity,
        title: "Incident Severity",
        description: "How severe is this incident. Is it critical? or a minor incident?. This is related to Incident Severity.",
    }),
    ManyToOne(() => {
        return IncidentSeverity;
    }, {
        eager: false,
        nullable: true,
        orphanedRowAction: "nullify",
    }),
    JoinColumn({ name: "incidentSeverityId" }),
    __metadata("design:type", IncidentSeverity)
], Incident.prototype, "incidentSeverity", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateProjectIncident,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadProjectIncident,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.EditProjectIncident,
        ],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.ObjectID,
        required: true,
        title: "Incident Severity ID",
        description: "Incident Severity ID",
        example: "e5f6a7b8-c9d0-1234-efgh-567890123456",
    }),
    Column({
        type: ColumnType.ObjectID,
        nullable: false,
        transformer: ObjectID.getDatabaseTransformer(),
    }),
    __metadata("design:type", ObjectID)
], Incident.prototype, "incidentSeverityId", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateProjectIncident,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadProjectIncident,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.EditProjectIncident,
        ],
    }),
    TableColumn({
        manyToOneRelationColumn: "changeMonitorStatusToId",
        type: TableColumnType.Entity,
        modelType: IncidentState,
        title: "Change Monitor Status To",
        description: "Relation to Monitor Status Object. All monitors connected to this incident will be changed to this status when the incident is created.",
    }),
    ManyToOne(() => {
        return MonitorStatus;
    }, {
        eager: false,
        nullable: true,
        orphanedRowAction: "nullify",
    }),
    JoinColumn({ name: "changeMonitorStatusToId" }),
    __metadata("design:type", MonitorStatus)
], Incident.prototype, "changeMonitorStatusTo", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateProjectIncident,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadProjectIncident,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.EditProjectIncident,
        ],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.ObjectID,
        required: false,
        title: "Change Monitor Status To ID",
        description: "Relation to Monitor Status Object ID. All monitors connected to this incident will be changed to this status when the incident is created.",
    }),
    Column({
        type: ColumnType.ObjectID,
        nullable: true,
        transformer: ObjectID.getDatabaseTransformer(),
    }),
    __metadata("design:type", ObjectID)
], Incident.prototype, "changeMonitorStatusToId", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateProjectIncident,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadProjectIncident,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.EditProjectIncident,
        ],
    }),
    TableColumn({
        isDefaultValueColumn: true,
        computed: true,
        hideColumnInDocumentation: true,
        type: TableColumnType.ShortText,
        title: "Subscriber Notification Status",
        description: "Status of notification sent to subscribers about this incident",
        defaultValue: StatusPageSubscriberNotificationStatus.Pending,
    }),
    Column({
        type: ColumnType.ShortText,
        default: StatusPageSubscriberNotificationStatus.Pending,
    }),
    __metadata("design:type", String)
], Incident.prototype, "subscriberNotificationStatusOnIncidentCreated", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateProjectIncident,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadProjectIncident,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.EditProjectIncident,
        ],
    }),
    TableColumn({
        type: TableColumnType.VeryLongText,
        title: "Notification Status Message",
        description: "Status message for subscriber notifications - includes success messages, failure reasons, or skip reasons",
        required: false,
    }),
    Column({
        type: ColumnType.VeryLongText,
        nullable: true,
    }),
    __metadata("design:type", String)
], Incident.prototype, "subscriberNotificationStatusMessage", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateProjectIncident,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadProjectIncident,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.EditProjectIncident,
        ],
    }),
    TableColumn({
        isDefaultValueColumn: true,
        computed: true,
        hideColumnInDocumentation: true,
        type: TableColumnType.ShortText,
        title: "Subscriber Notification Status on Postmortem Published",
        description: "Status of notification sent to subscribers about this incident postmortem",
        defaultValue: StatusPageSubscriberNotificationStatus.Pending,
    }),
    Column({
        type: ColumnType.ShortText,
        default: StatusPageSubscriberNotificationStatus.Pending,
    }),
    __metadata("design:type", String)
], Incident.prototype, "subscriberNotificationStatusOnPostmortemPublished", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateProjectIncident,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadProjectIncident,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.EditProjectIncident,
        ],
    }),
    TableColumn({
        type: TableColumnType.VeryLongText,
        title: "Notification Status Message on Postmortem Published",
        description: "Status message for subscriber notifications on postmortem published - includes success messages, failure reasons, or skip reasons",
        required: false,
    }),
    Column({
        type: ColumnType.VeryLongText,
        nullable: true,
    }),
    __metadata("design:type", String)
], Incident.prototype, "subscriberNotificationStatusMessageOnPostmortemPublished", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateProjectIncident,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadProjectIncident,
        ],
        update: [],
    }),
    TableColumn({
        isDefaultValueColumn: true,
        type: TableColumnType.Boolean,
        title: "Should subscribers be notified?",
        description: "Should subscribers be notified about this incident?",
        defaultValue: true,
    }),
    Column({
        type: ColumnType.Boolean,
        default: true,
    }),
    __metadata("design:type", Boolean)
], Incident.prototype, "shouldStatusPageSubscribersBeNotifiedOnIncidentCreated", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateProjectIncident,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadProjectIncident,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.EditProjectIncident,
        ],
    }),
    TableColumn({
        isDefaultValueColumn: false,
        required: false,
        type: TableColumnType.JSON,
        title: "Custom Fields",
        description: "Custom Fields on this resource.",
    }),
    Column({
        type: ColumnType.JSON,
        nullable: true,
    }),
    __metadata("design:type", Object)
], Incident.prototype, "customFields", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadProjectIncident,
        ],
        update: [],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.Boolean,
        computed: true,
        hideColumnInDocumentation: true,
        required: true,
        isDefaultValueColumn: true,
        title: "Are Owners Notified Of Resource Creation?",
        description: "Are owners notified of when this resource is created?",
        defaultValue: false,
    }),
    Column({
        type: ColumnType.Boolean,
        nullable: false,
        default: false,
    }),
    __metadata("design:type", Boolean)
], Incident.prototype, "isOwnerNotifiedOfResourceCreation", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateProjectIncident,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadProjectIncident,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.EditProjectIncident,
        ],
    }),
    TableColumn({
        type: TableColumnType.Markdown,
        required: false,
        isDefaultValueColumn: false,
        title: "Root Cause",
        description: "What is the root cause of this incident?",
    }),
    Column({
        type: ColumnType.Markdown,
        nullable: true,
    }),
    __metadata("design:type", String)
], Incident.prototype, "rootCause", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateProjectIncident,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadProjectIncident,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.EditProjectIncident,
        ],
    }),
    TableColumn({
        type: TableColumnType.Markdown,
        required: false,
        isDefaultValueColumn: false,
        title: "Postmortem Note",
        description: "Document the postmortem summary for this incident.",
    }),
    Column({
        type: ColumnType.Markdown,
        nullable: true,
    }),
    __metadata("design:type", String)
], Incident.prototype, "postmortemNote", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateProjectIncident,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadProjectIncident,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.EditProjectIncident,
        ],
    }),
    TableColumn({
        type: TableColumnType.Boolean,
        title: "Show postmortem on status page?",
        description: "Should the postmortem note and attachments be visible on the status page once published?",
        defaultValue: false,
        isDefaultValueColumn: true,
    }),
    Column({
        type: ColumnType.Boolean,
        default: false,
    }),
    __metadata("design:type", Boolean)
], Incident.prototype, "showPostmortemOnStatusPage", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateProjectIncident,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadProjectIncident,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.EditProjectIncident,
        ],
    }),
    TableColumn({
        type: TableColumnType.Boolean,
        title: "Notify Subscribers on Postmortem Published",
        description: "Should subscribers be notified when the postmortem is published?",
        defaultValue: true,
        isDefaultValueColumn: true,
    }),
    Column({
        type: ColumnType.Boolean,
        default: true,
    }),
    __metadata("design:type", Boolean)
], Incident.prototype, "notifySubscribersOnPostmortemPublished", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateProjectIncident,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadProjectIncident,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.EditProjectIncident,
        ],
    }),
    TableColumn({
        type: TableColumnType.Date,
        title: "Postmortem Posted At",
        description: "Timestamp that will be shown alongside the published postmortem on the status page.",
        required: false,
    }),
    Column({
        type: ColumnType.Date,
        nullable: true,
    }),
    __metadata("design:type", Date)
], Incident.prototype, "postmortemPostedAt", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateProjectIncident,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadProjectIncident,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.EditProjectIncident,
        ],
    }),
    TableColumn({
        type: TableColumnType.EntityArray,
        modelType: File,
        title: "Postmortem Attachments",
        description: "Files that accompany the postmortem note and can be shared publicly when enabled.",
        required: false,
    }),
    ManyToMany(() => {
        return File;
    }),
    JoinTable({
        name: "IncidentPostmortemAttachmentFile",
        joinColumn: {
            name: "incidentId",
            referencedColumnName: "_id",
        },
        inverseJoinColumn: {
            name: "fileId",
            referencedColumnName: "_id",
        },
    }),
    __metadata("design:type", Array)
], Incident.prototype, "postmortemAttachments", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadProjectIncident,
        ],
        update: [],
    }),
    TableColumn({
        isDefaultValueColumn: false,
        required: false,
        type: TableColumnType.JSON,
        computed: true,
    }),
    Column({
        type: ColumnType.JSON,
        nullable: true,
        unique: false,
    }),
    __metadata("design:type", Object)
], Incident.prototype, "createdStateLog", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadProjectIncident,
        ],
        update: [],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.LongText,
        required: false,
        isDefaultValueColumn: false,
        title: "Created Criteria ID",
        description: "If this incident was created by a Probe, this is the ID of the criteria that created it.",
    }),
    Column({
        type: ColumnType.LongText,
        nullable: true,
    }),
    __metadata("design:type", String)
], Incident.prototype, "createdCriteriaId", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadProjectIncident,
        ],
        update: [],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.LongText,
        required: false,
        isDefaultValueColumn: false,
        title: "Created Incident Template ID",
        description: "If this incident was created by a Probe, this is the ID of the incident template that was used for creation.",
    }),
    Column({
        type: ColumnType.LongText,
        nullable: true,
    }),
    __metadata("design:type", String)
], Incident.prototype, "createdIncidentTemplateId", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadProjectIncident,
        ],
        update: [],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.LongText,
        required: false,
        isDefaultValueColumn: false,
        title: "Series Fingerprint",
        description: "For metric monitors with per-series alerting (e.g. grouped by host.name), this is a stable hash of the series label values so one incident is created per affected series.",
    }),
    Column({
        type: ColumnType.LongText,
        nullable: true,
    }),
    __metadata("design:type", String)
], Incident.prototype, "seriesFingerprint", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadProjectIncident,
        ],
        update: [],
    }),
    TableColumn({
        type: TableColumnType.JSON,
        required: false,
        isDefaultValueColumn: false,
        title: "Series Labels",
        description: "Attribute key/value pairs that identify the affected series (e.g. {host.name: prod-db-01}) when this incident was created from a per-series metric breach.",
    }),
    Column({
        type: ColumnType.JSON,
        nullable: true,
    }),
    __metadata("design:type", Object)
], Incident.prototype, "seriesLabels", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadProjectIncident,
        ],
        update: [],
    }),
    TableColumn({
        manyToOneRelationColumn: "createdByProbeId",
        type: TableColumnType.Entity,
        modelType: Probe,
        title: "Created By Probe",
        description: "If this incident was created by a Probe, this is the probe that created it.",
    }),
    ManyToOne(() => {
        return Probe;
    }, {
        eager: false,
        nullable: true,
        onDelete: "SET NULL",
        orphanedRowAction: "nullify",
    }),
    JoinColumn({ name: "createdByProbeId" }),
    __metadata("design:type", Probe)
], Incident.prototype, "createdByProbe", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadProjectIncident,
        ],
        update: [],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.ObjectID,
        required: false,
        canReadOnRelationQuery: true,
        title: "Created By Probe ID",
        description: "If this incident was created by a Probe, this is the ID of the probe that created it.",
    }),
    Column({
        type: ColumnType.ObjectID,
        nullable: true,
        transformer: ObjectID.getDatabaseTransformer(),
    }),
    __metadata("design:type", ObjectID)
], Incident.prototype, "createdByProbeId", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadProjectIncident,
        ],
        update: [],
    }),
    TableColumn({
        isDefaultValueColumn: true,
        type: TableColumnType.Boolean,
        title: "Is created automatically?",
        description: "Is this incident created by OneUptime Probe or Workers automatically (and not created manually by a user)?",
        defaultValue: false,
    }),
    Column({
        type: ColumnType.Boolean,
        default: false,
    }),
    __metadata("design:type", Boolean)
], Incident.prototype, "isCreatedAutomatically", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateProjectIncident,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadProjectIncident,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.EditProjectIncident,
        ],
    }),
    TableColumn({
        required: false,
        type: TableColumnType.Markdown,
        title: "Remediation Notes",
        description: "Notes on how to remediate this incident. This is in markdown.",
    }),
    Column({
        nullable: true,
        type: ColumnType.Markdown,
    }),
    __metadata("design:type", String)
], Incident.prototype, "remediationNotes", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateProjectIncident,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadProjectIncident,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.EditProjectIncident,
        ],
    }),
    TableColumn({
        isDefaultValueColumn: false,
        required: false,
        type: TableColumnType.JSON,
        title: "Telemetry Query",
        description: "Telemetry query for this incident",
    }),
    Column({
        type: ColumnType.JSON,
        nullable: true,
    }),
    __metadata("design:type", Object)
], Incident.prototype, "telemetryQuery", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadProjectIncident,
        ],
        update: [],
    }),
    Index(),
    TableColumn({
        isDefaultValueColumn: false,
        required: false,
        type: TableColumnType.Number,
        title: "Incident Number",
        description: "Incident Number",
        computed: true,
        canReadOnRelationQuery: true,
    }),
    Column({
        type: ColumnType.Number,
        nullable: true,
    }),
    __metadata("design:type", Number)
], Incident.prototype, "incidentNumber", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadProjectIncident,
        ],
        update: [],
    }),
    TableColumn({
        isDefaultValueColumn: false,
        required: false,
        type: TableColumnType.ShortText,
        title: "Incident Number With Prefix",
        description: "Incident number with prefix (e.g., 'INC-42' or '#42')",
        computed: true,
        canReadOnRelationQuery: true,
    }),
    Column({
        type: ColumnType.ShortText,
        length: ColumnLength.ShortText,
        nullable: true,
    }),
    __metadata("design:type", String)
], Incident.prototype, "incidentNumberWithPrefix", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [],
        update: [],
    }),
    TableColumn({
        isDefaultValueColumn: false,
        required: false,
        type: TableColumnType.JSON,
        title: "Post Updates To Workspace Channel Name",
        description: "Post Updates To Workspace Channel Name",
    }),
    Column({
        type: ColumnType.JSON,
        nullable: true,
    }),
    __metadata("design:type", Array)
], Incident.prototype, "postUpdatesToWorkspaceChannels", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateProjectIncident,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadProjectIncident,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.EditProjectIncident,
        ],
    }),
    TableColumn({
        isDefaultValueColumn: true,
        type: TableColumnType.Boolean,
        title: "Should be visible on status page?",
        description: "Should this incident be visible on the status page?",
        defaultValue: true,
    }),
    Column({
        type: ColumnType.Boolean,
        default: true,
        nullable: true,
    }),
    __metadata("design:type", Boolean)
], Incident.prototype, "isVisibleOnStatusPage", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateProjectIncident,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadProjectIncident,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.EditProjectIncident,
        ],
    }),
    Index(),
    TableColumn({
        isDefaultValueColumn: true,
        type: TableColumnType.Boolean,
        title: "Is Private?",
        description: "If true, this incident is only visible to its owners (users in 'owner users' and members of 'owner teams'), project admins, and project owners. Private incidents are hidden from status pages.",
        defaultValue: false,
    }),
    Column({
        type: ColumnType.Boolean,
        default: false,
        nullable: true,
    }),
    __metadata("design:type", Boolean)
], Incident.prototype, "isPrivate", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateProjectIncident,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadProjectIncident,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.EditProjectIncident,
        ],
    }),
    TableColumn({
        manyToOneRelationColumn: "incidentEpisodeId",
        type: TableColumnType.Entity,
        modelType: IncidentEpisode,
        title: "Incident Episode",
        description: "Relation to Incident Episode this incident belongs to",
    }),
    ManyToOne(() => {
        return IncidentEpisode;
    }, {
        eager: false,
        nullable: true,
        onDelete: "SET NULL",
        orphanedRowAction: "nullify",
    }),
    JoinColumn({ name: "incidentEpisodeId" }),
    __metadata("design:type", IncidentEpisode)
], Incident.prototype, "incidentEpisode", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateProjectIncident,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadProjectIncident,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.EditProjectIncident,
        ],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.ObjectID,
        required: false,
        title: "Incident Episode ID",
        description: "ID of the Incident Episode this incident belongs to",
    }),
    Column({
        type: ColumnType.ObjectID,
        nullable: true,
        transformer: ObjectID.getDatabaseTransformer(),
    }),
    __metadata("design:type", ObjectID)
], Incident.prototype, "incidentEpisodeId", void 0);
Incident = __decorate([
    OperationalResource(),
    EnableDocumentation(),
    EnableMCP(),
    AccessControlColumn("labels"),
    MultiTenentQueryAllowed(true),
    TenantColumn("projectId"),
    TableAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateProjectIncident,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadProjectIncident,
        ],
        delete: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.DeleteProjectIncident,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.EditProjectIncident,
        ],
    }),
    CrudApiEndpoint(new Route("/incident")),
    SlugifyColumn("name", "slug"),
    Entity({
        name: "Incident",
    }),
    EnableWorkflow({
        create: true,
        delete: true,
        update: true,
        read: true,
    }),
    EnableAuditLog(),
    TableMetadata({
        tableName: "Incident",
        singularName: "Incident",
        pluralName: "Incidents",
        icon: IconProp.Alert,
        tableDescription: "Manage incidents for your project",
        enableRealtimeEventsOn: {
            create: true,
            update: true,
            delete: true,
        },
    }),
    Index(["projectId", "currentIncidentStateId"]) // Active-incident counters on dashboard
], Incident);
export default Incident;
//# sourceMappingURL=Incident.js.map