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 IncidentGroupingRule from "./IncidentGroupingRule";
import IncidentSeverity from "./IncidentSeverity";
import IncidentState from "./IncidentState";
import Label from "./Label";
import OnCallDutyPolicy from "./OnCallDutyPolicy";
import Project from "./Project";
import Team from "./Team";
import User from "./User";
import BaseModel from "./DatabaseBaseModel/DatabaseBaseModel";
import Route from "../../Types/API/Route";
import ColumnAccessControl from "../../Types/Database/AccessControl/ColumnAccessControl";
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 EnableWorkflow from "../../Types/Database/EnableWorkflow";
import MultiTenentQueryAllowed from "../../Types/Database/MultiTenentQueryAllowed";
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 { Column, Entity, Index, JoinColumn, JoinTable, ManyToMany, ManyToOne, } from "typeorm";
import StatusPageSubscriberNotificationStatus from "../../Types/StatusPage/StatusPageSubscriberNotificationStatus";
let IncidentEpisode = class IncidentEpisode extends BaseModel {
    constructor() {
        super(...arguments);
        this.project = undefined;
        this.projectId = undefined;
        this.title = undefined;
        this.description = undefined;
        this.episodeNumber = undefined;
        this.episodeNumberWithPrefix = undefined;
        this.currentIncidentState = undefined;
        this.currentIncidentStateId = undefined;
        this.incidentSeverity = undefined;
        this.incidentSeverityId = undefined;
        this.rootCause = undefined;
        this.lastIncidentAddedAt = undefined;
        this.resolvedAt = undefined;
        this.allIncidentsResolvedAt = undefined;
        this.assignedToUser = undefined;
        this.assignedToUserId = undefined;
        this.assignedToTeam = undefined;
        this.assignedToTeamId = undefined;
        this.onCallDutyPolicies = undefined;
        this.isOnCallPolicyExecuted = undefined;
        this.incidentCount = undefined;
        this.titleTemplate = undefined;
        this.descriptionTemplate = undefined;
        this.isManuallyCreated = undefined;
        this.labels = undefined;
        this.createdByUser = undefined;
        this.createdByUserId = undefined;
        this.deletedByUser = undefined;
        this.deletedByUserId = undefined;
        this.isOwnerNotifiedOfEpisodeCreation = undefined;
        this.groupingKey = undefined;
        this.incidentGroupingRule = undefined;
        this.incidentGroupingRuleId = undefined;
        this.remediationNotes = undefined;
        this.postmortemNote = undefined;
        this.postUpdatesToWorkspaceChannels = undefined;
        this.isVisibleOnStatusPage = undefined;
        this.declaredAt = undefined;
        this.shouldStatusPageSubscribersBeNotifiedOnEpisodeCreated = undefined;
        this.subscriberNotificationStatusOnEpisodeCreated = undefined;
        this.subscriberNotificationStatusMessage = undefined;
        this.isPrivate = undefined;
    }
};
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateIncidentEpisode,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadIncidentEpisode,
        ],
        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)
], IncidentEpisode.prototype, "project", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateIncidentEpisode,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadIncidentEpisode,
        ],
        update: [],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.ObjectID,
        required: true,
        canReadOnRelationQuery: true,
        title: "Project ID",
        description: "ID of your OneUptime Project in which this object belongs",
    }),
    Column({
        type: ColumnType.ObjectID,
        nullable: false,
        transformer: ObjectID.getDatabaseTransformer(),
    }),
    __metadata("design:type", ObjectID)
], IncidentEpisode.prototype, "projectId", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateIncidentEpisode,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadIncidentEpisode,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.EditIncidentEpisode,
        ],
    }),
    Index(),
    TableColumn({
        required: true,
        type: TableColumnType.LongText,
        canReadOnRelationQuery: true,
        title: "Title",
        description: "Title of this incident episode",
    }),
    Column({
        nullable: false,
        type: ColumnType.LongText,
        length: ColumnLength.LongText,
    }),
    __metadata("design:type", String)
], IncidentEpisode.prototype, "title", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateIncidentEpisode,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadIncidentEpisode,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.EditIncidentEpisode,
        ],
    }),
    TableColumn({
        required: false,
        type: TableColumnType.Markdown,
        title: "Description",
        description: "Description of this incident episode. This is in markdown format.",
    }),
    Column({
        nullable: true,
        type: ColumnType.Markdown,
    }),
    __metadata("design:type", String)
], IncidentEpisode.prototype, "description", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateIncidentEpisode,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadIncidentEpisode,
        ],
        update: [],
    }),
    Index(),
    TableColumn({
        isDefaultValueColumn: false,
        required: false,
        type: TableColumnType.Number,
        title: "Episode Number",
        description: "Auto-incrementing episode number per project",
    }),
    Column({
        type: ColumnType.Number,
        nullable: true,
    }),
    __metadata("design:type", Number)
], IncidentEpisode.prototype, "episodeNumber", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadIncidentEpisode,
        ],
        update: [],
    }),
    TableColumn({
        isDefaultValueColumn: false,
        required: false,
        type: TableColumnType.ShortText,
        title: "Episode Number With Prefix",
        description: "Episode number with prefix (e.g., 'IE-42' or '#42')",
        computed: true,
    }),
    Column({
        type: ColumnType.ShortText,
        length: ColumnLength.ShortText,
        nullable: true,
    }),
    __metadata("design:type", String)
], IncidentEpisode.prototype, "episodeNumberWithPrefix", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateIncidentEpisode,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadIncidentEpisode,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.EditIncidentEpisode,
        ],
    }),
    TableColumn({
        manyToOneRelationColumn: "currentIncidentStateId",
        type: TableColumnType.Entity,
        modelType: IncidentState,
        title: "Current Incident State",
        description: "Current state of this episode. Is the episode acknowledged? or resolved?",
    }),
    ManyToOne(() => {
        return IncidentState;
    }, {
        eager: false,
        nullable: true,
        orphanedRowAction: "nullify",
    }),
    JoinColumn({ name: "currentIncidentStateId" }),
    __metadata("design:type", IncidentState)
], IncidentEpisode.prototype, "currentIncidentState", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateIncidentEpisode,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadIncidentEpisode,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.EditIncidentEpisode,
        ],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.ObjectID,
        required: true,
        isDefaultValueColumn: true,
        title: "Current Incident State ID",
        description: "Current Incident State ID",
    }),
    Column({
        type: ColumnType.ObjectID,
        nullable: false,
        transformer: ObjectID.getDatabaseTransformer(),
    }),
    __metadata("design:type", ObjectID)
], IncidentEpisode.prototype, "currentIncidentStateId", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateIncidentEpisode,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadIncidentEpisode,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.EditIncidentEpisode,
        ],
    }),
    TableColumn({
        manyToOneRelationColumn: "incidentSeverityId",
        type: TableColumnType.Entity,
        modelType: IncidentSeverity,
        title: "Incident Severity",
        description: "High-water mark severity of this episode. Represents the highest severity among all member incidents.",
    }),
    ManyToOne(() => {
        return IncidentSeverity;
    }, {
        eager: false,
        nullable: true,
        orphanedRowAction: "nullify",
    }),
    JoinColumn({ name: "incidentSeverityId" }),
    __metadata("design:type", IncidentSeverity)
], IncidentEpisode.prototype, "incidentSeverity", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateIncidentEpisode,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadIncidentEpisode,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.EditIncidentEpisode,
        ],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.ObjectID,
        required: false,
        title: "Incident Severity ID",
        description: "Incident Severity ID",
    }),
    Column({
        type: ColumnType.ObjectID,
        nullable: true,
        transformer: ObjectID.getDatabaseTransformer(),
    }),
    __metadata("design:type", ObjectID)
], IncidentEpisode.prototype, "incidentSeverityId", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateIncidentEpisode,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadIncidentEpisode,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.EditIncidentEpisode,
        ],
    }),
    TableColumn({
        type: TableColumnType.Markdown,
        required: false,
        isDefaultValueColumn: false,
        title: "Root Cause",
        description: "User-documented root cause of this episode",
    }),
    Column({
        type: ColumnType.Markdown,
        nullable: true,
    }),
    __metadata("design:type", String)
], IncidentEpisode.prototype, "rootCause", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateIncidentEpisode,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadIncidentEpisode,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.EditIncidentEpisode,
        ],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.Date,
        title: "Last Incident Added At",
        description: "When the last incident was added to this episode",
    }),
    Column({
        type: ColumnType.Date,
        nullable: true,
        unique: false,
    }),
    __metadata("design:type", Date)
], IncidentEpisode.prototype, "lastIncidentAddedAt", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateIncidentEpisode,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadIncidentEpisode,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.EditIncidentEpisode,
        ],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.Date,
        title: "Resolved At",
        description: "When this episode was resolved",
    }),
    Column({
        type: ColumnType.Date,
        nullable: true,
        unique: false,
    }),
    __metadata("design:type", Date)
], IncidentEpisode.prototype, "resolvedAt", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadIncidentEpisode,
        ],
        update: [],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.Date,
        title: "All Incidents Resolved At",
        description: "When all incidents in this episode were first detected as resolved. Used for resolve delay calculation.",
    }),
    Column({
        type: ColumnType.Date,
        nullable: true,
        unique: false,
    }),
    __metadata("design:type", Date)
], IncidentEpisode.prototype, "allIncidentsResolvedAt", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateIncidentEpisode,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadIncidentEpisode,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.EditIncidentEpisode,
        ],
    }),
    TableColumn({
        manyToOneRelationColumn: "assignedToUserId",
        type: TableColumnType.Entity,
        modelType: User,
        title: "Assigned To User",
        description: "User who is assigned to this episode",
    }),
    ManyToOne(() => {
        return User;
    }, {
        eager: false,
        nullable: true,
        onDelete: "SET NULL",
        orphanedRowAction: "nullify",
    }),
    JoinColumn({ name: "assignedToUserId" }),
    __metadata("design:type", User)
], IncidentEpisode.prototype, "assignedToUser", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateIncidentEpisode,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadIncidentEpisode,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.EditIncidentEpisode,
        ],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.ObjectID,
        required: false,
        title: "Assigned To User ID",
        description: "User ID who is assigned to this episode",
    }),
    Column({
        type: ColumnType.ObjectID,
        nullable: true,
        transformer: ObjectID.getDatabaseTransformer(),
    }),
    __metadata("design:type", ObjectID)
], IncidentEpisode.prototype, "assignedToUserId", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateIncidentEpisode,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadIncidentEpisode,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.EditIncidentEpisode,
        ],
    }),
    TableColumn({
        manyToOneRelationColumn: "assignedToTeamId",
        type: TableColumnType.Entity,
        modelType: Team,
        title: "Assigned To Team",
        description: "Team that is assigned to this episode",
    }),
    ManyToOne(() => {
        return Team;
    }, {
        eager: false,
        nullable: true,
        onDelete: "SET NULL",
        orphanedRowAction: "nullify",
    }),
    JoinColumn({ name: "assignedToTeamId" }),
    __metadata("design:type", Team)
], IncidentEpisode.prototype, "assignedToTeam", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateIncidentEpisode,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadIncidentEpisode,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.EditIncidentEpisode,
        ],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.ObjectID,
        required: false,
        title: "Assigned To Team ID",
        description: "Team ID that is assigned to this episode",
    }),
    Column({
        type: ColumnType.ObjectID,
        nullable: true,
        transformer: ObjectID.getDatabaseTransformer(),
    }),
    __metadata("design:type", ObjectID)
], IncidentEpisode.prototype, "assignedToTeamId", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateIncidentEpisode,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadIncidentEpisode,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.EditIncidentEpisode,
        ],
    }),
    TableColumn({
        required: false,
        type: TableColumnType.EntityArray,
        modelType: OnCallDutyPolicy,
        title: "On-Call Duty Policies",
        description: "List of on-call duty policies to execute for this episode.",
    }),
    ManyToMany(() => {
        return OnCallDutyPolicy;
    }, { eager: false }),
    JoinTable({
        name: "IncidentEpisodeOnCallDutyPolicy",
        inverseJoinColumn: {
            name: "onCallDutyPolicyId",
            referencedColumnName: "_id",
        },
        joinColumn: {
            name: "incidentEpisodeId",
            referencedColumnName: "_id",
        },
    }),
    __metadata("design:type", Array)
], IncidentEpisode.prototype, "onCallDutyPolicies", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadIncidentEpisode,
        ],
        update: [],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.Boolean,
        required: true,
        isDefaultValueColumn: true,
        title: "Is On-Call Policy Executed?",
        description: "Whether the on-call policy has been executed for this episode",
        defaultValue: false,
    }),
    Column({
        type: ColumnType.Boolean,
        nullable: false,
        default: false,
    }),
    __metadata("design:type", Boolean)
], IncidentEpisode.prototype, "isOnCallPolicyExecuted", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadIncidentEpisode,
        ],
        update: [],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.Number,
        required: true,
        isDefaultValueColumn: true,
        computed: true,
        title: "Incident Count",
        description: "Denormalized count of incidents in this episode",
        defaultValue: 0,
    }),
    Column({
        type: ColumnType.Number,
        nullable: false,
        default: 0,
    }),
    __metadata("design:type", Number)
], IncidentEpisode.prototype, "incidentCount", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateIncidentEpisode,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadIncidentEpisode,
        ],
        update: [],
    }),
    TableColumn({
        required: false,
        type: TableColumnType.LongText,
        title: "Title Template",
        description: "Template used to generate the episode title. Stored for dynamic variable updates.",
    }),
    Column({
        type: ColumnType.LongText,
        nullable: true,
    }),
    __metadata("design:type", String)
], IncidentEpisode.prototype, "titleTemplate", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateIncidentEpisode,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadIncidentEpisode,
        ],
        update: [],
    }),
    TableColumn({
        required: false,
        type: TableColumnType.LongText,
        title: "Description Template",
        description: "Template used to generate the episode description. Stored for dynamic variable updates.",
    }),
    Column({
        type: ColumnType.LongText,
        nullable: true,
    }),
    __metadata("design:type", String)
], IncidentEpisode.prototype, "descriptionTemplate", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateIncidentEpisode,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadIncidentEpisode,
        ],
        update: [],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.Boolean,
        required: true,
        isDefaultValueColumn: true,
        title: "Is Manually Created?",
        description: "Whether this episode was manually created vs auto-created by a rule",
        defaultValue: false,
    }),
    Column({
        type: ColumnType.Boolean,
        nullable: false,
        default: false,
    }),
    __metadata("design:type", Boolean)
], IncidentEpisode.prototype, "isManuallyCreated", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateIncidentEpisode,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadIncidentEpisode,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.EditIncidentEpisode,
        ],
    }),
    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: "IncidentEpisodeLabel",
        inverseJoinColumn: {
            name: "labelId",
            referencedColumnName: "_id",
        },
        joinColumn: {
            name: "incidentEpisodeId",
            referencedColumnName: "_id",
        },
    }),
    __metadata("design:type", Array)
], IncidentEpisode.prototype, "labels", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateIncidentEpisode,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadIncidentEpisode,
        ],
        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)
], IncidentEpisode.prototype, "createdByUser", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateIncidentEpisode,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadIncidentEpisode,
        ],
        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)
], IncidentEpisode.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)
], IncidentEpisode.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)
], IncidentEpisode.prototype, "deletedByUserId", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadIncidentEpisode,
        ],
        update: [],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.Boolean,
        required: true,
        isDefaultValueColumn: true,
        title: "Are Owners Notified Of Episode Creation?",
        description: "Are owners notified when this episode is created?",
        defaultValue: false,
    }),
    Column({
        type: ColumnType.Boolean,
        nullable: false,
        default: false,
    }),
    __metadata("design:type", Boolean)
], IncidentEpisode.prototype, "isOwnerNotifiedOfEpisodeCreation", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateIncidentEpisode,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadIncidentEpisode,
        ],
        update: [],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.LongText,
        required: false,
        title: "Grouping Key",
        description: "Key used for grouping incidents into this episode. Generated from groupByFields of the matching rule.",
    }),
    Column({
        type: ColumnType.LongText,
        nullable: true,
        length: ColumnLength.LongText,
    }),
    __metadata("design:type", String)
], IncidentEpisode.prototype, "groupingKey", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateIncidentEpisode,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadIncidentEpisode,
        ],
        update: [],
    }),
    TableColumn({
        manyToOneRelationColumn: "incidentGroupingRuleId",
        type: TableColumnType.Entity,
        modelType: IncidentGroupingRule,
        title: "Incident Grouping Rule",
        description: "Relation to the Incident Grouping Rule that created this episode (if applicable)",
    }),
    ManyToOne(() => {
        return IncidentGroupingRule;
    }, {
        eager: false,
        nullable: true,
        onDelete: "SET NULL",
        orphanedRowAction: "nullify",
    }),
    JoinColumn({ name: "incidentGroupingRuleId" }),
    __metadata("design:type", IncidentGroupingRule)
], IncidentEpisode.prototype, "incidentGroupingRule", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateIncidentEpisode,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadIncidentEpisode,
        ],
        update: [],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.ObjectID,
        required: false,
        title: "Incident Grouping Rule ID",
        description: "ID of the Incident Grouping Rule that created this episode (if applicable)",
    }),
    Column({
        type: ColumnType.ObjectID,
        nullable: true,
        transformer: ObjectID.getDatabaseTransformer(),
    }),
    __metadata("design:type", ObjectID)
], IncidentEpisode.prototype, "incidentGroupingRuleId", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateIncidentEpisode,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadIncidentEpisode,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.EditIncidentEpisode,
        ],
    }),
    TableColumn({
        type: TableColumnType.Markdown,
        required: false,
        isDefaultValueColumn: false,
        title: "Remediation Notes",
        description: "User-documented remediation steps and notes for this episode",
    }),
    Column({
        type: ColumnType.Markdown,
        nullable: true,
    }),
    __metadata("design:type", String)
], IncidentEpisode.prototype, "remediationNotes", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateIncidentEpisode,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadIncidentEpisode,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.EditIncidentEpisode,
        ],
    }),
    TableColumn({
        type: TableColumnType.Markdown,
        required: false,
        isDefaultValueColumn: false,
        title: "Postmortem Note",
        description: "User-documented postmortem summary for this episode",
    }),
    Column({
        type: ColumnType.Markdown,
        nullable: true,
    }),
    __metadata("design:type", String)
], IncidentEpisode.prototype, "postmortemNote", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateIncidentEpisode,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadIncidentEpisode,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.EditIncidentEpisode,
        ],
    }),
    TableColumn({
        type: TableColumnType.JSON,
        required: false,
        isDefaultValueColumn: false,
        title: "Post Updates to Workspace Channels",
        description: "Workspace channels to post episode updates to (e.g., Slack, Microsoft Teams)",
    }),
    Column({
        type: ColumnType.JSON,
        nullable: true,
    }),
    __metadata("design:type", Array)
], IncidentEpisode.prototype, "postUpdatesToWorkspaceChannels", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateIncidentEpisode,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadIncidentEpisode,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.EditIncidentEpisode,
        ],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.Boolean,
        required: true,
        isDefaultValueColumn: true,
        title: "Visible on Status Page",
        description: "Should this episode be visible on the status page?",
        defaultValue: false,
    }),
    Column({
        type: ColumnType.Boolean,
        nullable: false,
        default: false,
    }),
    __metadata("design:type", Boolean)
], IncidentEpisode.prototype, "isVisibleOnStatusPage", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateIncidentEpisode,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadIncidentEpisode,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.EditIncidentEpisode,
        ],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.Date,
        title: "Declared At",
        description: "When this episode was declared",
    }),
    Column({
        type: ColumnType.Date,
        nullable: true,
        unique: false,
    }),
    __metadata("design:type", Date)
], IncidentEpisode.prototype, "declaredAt", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateIncidentEpisode,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadIncidentEpisode,
        ],
        update: [],
    }),
    TableColumn({
        isDefaultValueColumn: true,
        type: TableColumnType.Boolean,
        title: "Should subscribers be notified on episode created?",
        description: "Should status page subscribers be notified when this episode is created?",
        defaultValue: true,
    }),
    Column({
        type: ColumnType.Boolean,
        default: true,
    }),
    __metadata("design:type", Boolean)
], IncidentEpisode.prototype, "shouldStatusPageSubscribersBeNotifiedOnEpisodeCreated", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadIncidentEpisode,
        ],
        update: [],
    }),
    TableColumn({
        isDefaultValueColumn: true,
        computed: true,
        hideColumnInDocumentation: true,
        type: TableColumnType.ShortText,
        title: "Subscriber Notification Status on Episode Created",
        description: "Status of notification sent to subscribers when this episode was created",
        defaultValue: StatusPageSubscriberNotificationStatus.Pending,
    }),
    Column({
        type: ColumnType.ShortText,
        default: StatusPageSubscriberNotificationStatus.Pending,
    }),
    __metadata("design:type", String)
], IncidentEpisode.prototype, "subscriberNotificationStatusOnEpisodeCreated", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadIncidentEpisode,
        ],
        update: [],
    }),
    TableColumn({
        type: TableColumnType.VeryLongText,
        title: "Subscriber 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)
], IncidentEpisode.prototype, "subscriberNotificationStatusMessage", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateIncidentEpisode,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadIncidentEpisode,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.EditIncidentEpisode,
        ],
    }),
    Index(),
    TableColumn({
        isDefaultValueColumn: true,
        type: TableColumnType.Boolean,
        title: "Is Private?",
        description: "If true, this incident episode is only visible to its owners (users in 'owner users' and members of 'owner teams'), project admins, and project owners.",
        defaultValue: false,
    }),
    Column({
        type: ColumnType.Boolean,
        default: false,
        nullable: true,
    }),
    __metadata("design:type", Boolean)
], IncidentEpisode.prototype, "isPrivate", void 0);
IncidentEpisode = __decorate([
    EnableDocumentation(),
    AccessControlColumn("labels"),
    MultiTenentQueryAllowed(true),
    TenantColumn("projectId"),
    TableAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.CreateIncidentEpisode,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.IncidentViewer,
            Permission.ReadIncidentEpisode,
        ],
        delete: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.DeleteIncidentEpisode,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.IncidentAdmin,
            Permission.IncidentMember,
            Permission.EditIncidentEpisode,
        ],
    }),
    CrudApiEndpoint(new Route("/incident-episode")),
    Entity({
        name: "IncidentEpisode",
    }),
    EnableWorkflow({
        create: true,
        delete: true,
        update: true,
        read: true,
    }),
    TableMetadata({
        tableName: "IncidentEpisode",
        singularName: "Incident Episode",
        pluralName: "Incident Episodes",
        icon: IconProp.Layers,
        tableDescription: "Manage incident episodes (groups of related incidents) for your project",
        enableRealtimeEventsOn: {
            create: true,
            update: true,
            delete: true,
        },
    })
], IncidentEpisode);
export default IncidentEpisode;
//# sourceMappingURL=IncidentEpisode.js.map