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 Project from "./Project";
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 ColumnLength from "../../Types/Database/ColumnLength";
import ColumnType from "../../Types/Database/ColumnType";
import CrudApiEndpoint from "../../Types/Database/CrudApiEndpoint";
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 { Column, Entity, Index, JoinColumn, ManyToOne } from "typeorm";
import WorkspaceType from "../../Types/Workspace/WorkspaceType";
import WorkspaceNotificationSummaryType from "../../Types/Workspace/NotificationSummary/WorkspaceNotificationSummaryType";
import Permission from "../../Types/Permission";
import TableBillingAccessControl from "../../Types/Database/AccessControl/TableBillingAccessControl";
import { PlanType } from "../../Types/Billing/SubscriptionPlan";
import EnableDocumentation from "../../Types/Database/EnableDocumentation";
import Recurring from "../../Types/Events/Recurring";
import FilterCondition from "../../Types/Filter/FilterCondition";
let WorkspaceNotificationSummary = class WorkspaceNotificationSummary extends BaseModel {
    constructor() {
        super(...arguments);
        this.project = undefined;
        this.projectId = undefined;
        this.name = undefined;
        this.description = undefined;
        this.workspaceType = undefined;
        this.summaryType = undefined;
        this.recurringInterval = undefined;
        this.numberOfDaysOfData = undefined;
        this.sendFirstReportAt = undefined;
        this.channelNames = undefined;
        this.teamName = undefined;
        this.summaryItems = undefined;
        this.filters = undefined;
        this.filterCondition = undefined;
        this.nextSendAt = undefined;
        this.lastSentAt = undefined;
        this.isEnabled = undefined;
        this.createdByUser = undefined;
        this.createdByUserId = undefined;
        this.deletedByUser = undefined;
        this.deletedByUserId = undefined;
    }
};
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.CreateWorkspaceNotificationSummary,
        ],
        read: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.SettingsViewer,
            Permission.ReadWorkspaceNotificationSummary,
        ],
        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)
], WorkspaceNotificationSummary.prototype, "project", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.CreateWorkspaceNotificationSummary,
        ],
        read: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.SettingsViewer,
            Permission.ReadWorkspaceNotificationSummary,
        ],
        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)
], WorkspaceNotificationSummary.prototype, "projectId", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.CreateWorkspaceNotificationSummary,
        ],
        read: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.SettingsViewer,
            Permission.ReadWorkspaceNotificationSummary,
        ],
        update: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.EditWorkspaceNotificationSummary,
        ],
    }),
    TableColumn({
        title: "Summary Name",
        description: "Name of the Summary Rule",
        required: true,
        unique: false,
        type: TableColumnType.LongText,
        canReadOnRelationQuery: true,
    }),
    Column({
        type: ColumnType.LongText,
        length: ColumnLength.LongText,
        unique: false,
        nullable: false,
    }),
    __metadata("design:type", String)
], WorkspaceNotificationSummary.prototype, "name", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.CreateWorkspaceNotificationSummary,
        ],
        read: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.SettingsViewer,
            Permission.ReadWorkspaceNotificationSummary,
        ],
        update: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.EditWorkspaceNotificationSummary,
        ],
    }),
    TableColumn({
        title: "Summary Description",
        description: "Description of the Summary Rule",
        required: false,
        unique: false,
        type: TableColumnType.LongText,
        canReadOnRelationQuery: true,
    }),
    Column({
        type: ColumnType.LongText,
        length: ColumnLength.LongText,
        unique: false,
        nullable: true,
    }),
    __metadata("design:type", String)
], WorkspaceNotificationSummary.prototype, "description", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.CreateWorkspaceNotificationSummary,
        ],
        read: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.SettingsViewer,
            Permission.ReadWorkspaceNotificationSummary,
        ],
        update: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.EditWorkspaceNotificationSummary,
        ],
    }),
    TableColumn({
        title: "Workspace Type",
        description: "Type of Workspace - Slack, Microsoft Teams, etc.",
        required: true,
        unique: false,
        type: TableColumnType.LongText,
        canReadOnRelationQuery: true,
    }),
    Column({
        type: ColumnType.LongText,
        length: ColumnLength.LongText,
        unique: false,
        nullable: false,
    }),
    __metadata("design:type", String)
], WorkspaceNotificationSummary.prototype, "workspaceType", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.CreateWorkspaceNotificationSummary,
        ],
        read: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.SettingsViewer,
            Permission.ReadWorkspaceNotificationSummary,
        ],
        update: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.EditWorkspaceNotificationSummary,
        ],
    }),
    TableColumn({
        title: "Summary Type",
        description: "Type of summary - Incident, Alert, Incident Episode, or Alert Episode",
        required: true,
        unique: false,
        type: TableColumnType.ShortText,
        canReadOnRelationQuery: true,
    }),
    Column({
        type: ColumnType.ShortText,
        unique: false,
        nullable: false,
    }),
    __metadata("design:type", String)
], WorkspaceNotificationSummary.prototype, "summaryType", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.CreateWorkspaceNotificationSummary,
        ],
        read: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.SettingsViewer,
            Permission.ReadWorkspaceNotificationSummary,
        ],
        update: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.EditWorkspaceNotificationSummary,
        ],
    }),
    TableColumn({
        type: TableColumnType.JSON,
        title: "Recurring Interval",
        description: "How often should the summary be sent?",
        required: true,
    }),
    Column({
        type: ColumnType.JSON,
        nullable: false,
        transformer: Recurring.getDatabaseTransformer(),
    }),
    __metadata("design:type", Recurring)
], WorkspaceNotificationSummary.prototype, "recurringInterval", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.CreateWorkspaceNotificationSummary,
        ],
        read: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.SettingsViewer,
            Permission.ReadWorkspaceNotificationSummary,
        ],
        update: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.EditWorkspaceNotificationSummary,
        ],
    }),
    TableColumn({
        type: TableColumnType.Number,
        title: "Number of Days of Data",
        description: "How many days of data to include in the summary",
        required: true,
    }),
    Column({
        type: ColumnType.Number,
        nullable: false,
        default: 7,
    }),
    __metadata("design:type", Number)
], WorkspaceNotificationSummary.prototype, "numberOfDaysOfData", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.CreateWorkspaceNotificationSummary,
        ],
        read: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.SettingsViewer,
            Permission.ReadWorkspaceNotificationSummary,
        ],
        update: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.EditWorkspaceNotificationSummary,
        ],
    }),
    TableColumn({
        title: "Send First Report At",
        description: "When should the first summary report be sent? Subsequent reports will follow the recurring interval from this date.",
        required: false,
        unique: false,
        type: TableColumnType.Date,
    }),
    Column({
        type: ColumnType.Date,
        nullable: true,
    }),
    __metadata("design:type", Date)
], WorkspaceNotificationSummary.prototype, "sendFirstReportAt", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.CreateWorkspaceNotificationSummary,
        ],
        read: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.SettingsViewer,
            Permission.ReadWorkspaceNotificationSummary,
        ],
        update: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.EditWorkspaceNotificationSummary,
        ],
    }),
    TableColumn({
        type: TableColumnType.JSON,
        title: "Channel Names",
        description: "List of channel names to post the summary to",
        required: true,
    }),
    Column({
        type: ColumnType.JSON,
        nullable: false,
    }),
    __metadata("design:type", Array)
], WorkspaceNotificationSummary.prototype, "channelNames", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.CreateWorkspaceNotificationSummary,
        ],
        read: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.SettingsViewer,
            Permission.ReadWorkspaceNotificationSummary,
        ],
        update: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.EditWorkspaceNotificationSummary,
        ],
    }),
    TableColumn({
        title: "Team Name",
        description: "Microsoft Teams team name (only for Microsoft Teams)",
        required: false,
        unique: false,
        type: TableColumnType.LongText,
    }),
    Column({
        type: ColumnType.LongText,
        length: ColumnLength.LongText,
        unique: false,
        nullable: true,
    }),
    __metadata("design:type", String)
], WorkspaceNotificationSummary.prototype, "teamName", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.CreateWorkspaceNotificationSummary,
        ],
        read: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.SettingsViewer,
            Permission.ReadWorkspaceNotificationSummary,
        ],
        update: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.EditWorkspaceNotificationSummary,
        ],
    }),
    TableColumn({
        type: TableColumnType.JSON,
        title: "Summary Items",
        description: "Checklist of items to include in the summary",
        required: true,
    }),
    Column({
        type: ColumnType.JSON,
        nullable: false,
    }),
    __metadata("design:type", Array)
], WorkspaceNotificationSummary.prototype, "summaryItems", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.CreateWorkspaceNotificationSummary,
        ],
        read: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.SettingsViewer,
            Permission.ReadWorkspaceNotificationSummary,
        ],
        update: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.EditWorkspaceNotificationSummary,
        ],
    }),
    TableColumn({
        type: TableColumnType.JSON,
        title: "Filters",
        description: "Filter conditions for which items to include in the summary",
        required: false,
    }),
    Column({
        type: ColumnType.JSON,
        nullable: true,
    }),
    __metadata("design:type", Array)
], WorkspaceNotificationSummary.prototype, "filters", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.CreateWorkspaceNotificationSummary,
        ],
        read: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.SettingsViewer,
            Permission.ReadWorkspaceNotificationSummary,
        ],
        update: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.EditWorkspaceNotificationSummary,
        ],
    }),
    TableColumn({
        title: "Filter Condition",
        description: "How to combine filters - Any or All",
        required: false,
        unique: false,
        type: TableColumnType.ShortText,
    }),
    Column({
        type: ColumnType.ShortText,
        unique: false,
        nullable: true,
    }),
    __metadata("design:type", String)
], WorkspaceNotificationSummary.prototype, "filterCondition", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.CreateWorkspaceNotificationSummary,
        ],
        read: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.SettingsViewer,
            Permission.ReadWorkspaceNotificationSummary,
        ],
        update: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.EditWorkspaceNotificationSummary,
        ],
    }),
    TableColumn({
        type: TableColumnType.Date,
        title: "Next Send At",
        description: "When the next summary should be sent",
    }),
    Column({
        type: ColumnType.Date,
        nullable: true,
    }),
    __metadata("design:type", Date)
], WorkspaceNotificationSummary.prototype, "nextSendAt", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.CreateWorkspaceNotificationSummary,
        ],
        read: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.SettingsViewer,
            Permission.ReadWorkspaceNotificationSummary,
        ],
        update: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.EditWorkspaceNotificationSummary,
        ],
    }),
    TableColumn({
        type: TableColumnType.Date,
        title: "Last Sent At",
        description: "When the last summary was sent",
    }),
    Column({
        type: ColumnType.Date,
        nullable: true,
    }),
    __metadata("design:type", Date)
], WorkspaceNotificationSummary.prototype, "lastSentAt", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.CreateWorkspaceNotificationSummary,
        ],
        read: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.SettingsViewer,
            Permission.ReadWorkspaceNotificationSummary,
        ],
        update: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.EditWorkspaceNotificationSummary,
        ],
    }),
    TableColumn({
        type: TableColumnType.Boolean,
        title: "Enabled",
        description: "Is this summary rule enabled?",
        required: true,
    }),
    Column({
        type: ColumnType.Boolean,
        nullable: false,
        default: true,
    }),
    __metadata("design:type", Boolean)
], WorkspaceNotificationSummary.prototype, "isEnabled", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.CreateWorkspaceNotificationSummary,
        ],
        read: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.SettingsViewer,
            Permission.ReadWorkspaceNotificationSummary,
        ],
        update: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.EditWorkspaceNotificationSummary,
        ],
    }),
    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)
], WorkspaceNotificationSummary.prototype, "createdByUser", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.CreateWorkspaceNotificationSummary,
        ],
        read: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.SettingsViewer,
            Permission.ReadWorkspaceNotificationSummary,
        ],
        update: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.EditWorkspaceNotificationSummary,
        ],
    }),
    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)
], WorkspaceNotificationSummary.prototype, "createdByUserId", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.CreateWorkspaceNotificationSummary,
        ],
        read: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.SettingsViewer,
            Permission.ReadWorkspaceNotificationSummary,
        ],
        update: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.EditWorkspaceNotificationSummary,
        ],
    }),
    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)
], WorkspaceNotificationSummary.prototype, "deletedByUser", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.CreateWorkspaceNotificationSummary,
        ],
        read: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.SettingsViewer,
            Permission.ReadWorkspaceNotificationSummary,
        ],
        update: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.EditWorkspaceNotificationSummary,
        ],
    }),
    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)
], WorkspaceNotificationSummary.prototype, "deletedByUserId", void 0);
WorkspaceNotificationSummary = __decorate([
    EnableDocumentation(),
    TenantColumn("projectId"),
    TableAccessControl({
        create: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.CreateWorkspaceNotificationSummary,
        ],
        read: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.SettingsViewer,
            Permission.ReadWorkspaceNotificationSummary,
        ],
        delete: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.DeleteWorkspaceNotificationSummary,
        ],
        update: [
            Permission.ProjectAdmin,
            Permission.ProjectOwner,
            Permission.ProjectMember,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.EditWorkspaceNotificationSummary,
        ],
    }),
    TableBillingAccessControl({
        create: PlanType.Growth,
        read: PlanType.Growth,
        update: PlanType.Growth,
        delete: PlanType.Growth,
    }),
    CrudApiEndpoint(new Route("/workspace-notification-summary")),
    Entity({
        name: "WorkspaceNotificationSummary",
    }),
    TableMetadata({
        tableName: "WorkspaceNotificationSummary",
        singularName: "Workspace Notification Summary",
        pluralName: "Workspace Notification Summaries",
        icon: IconProp.ChartBar,
        tableDescription: "Recurring summary reports for incidents and alerts sent to Slack or Microsoft Teams",
    })
], WorkspaceNotificationSummary);
export default WorkspaceNotificationSummary;
//# sourceMappingURL=WorkspaceNotificationSummary.js.map