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 StatusPage from "./StatusPage";
import StatusPageResource from "./StatusPageResource";
import User from "./User";
import BaseModel from "./DatabaseBaseModel/DatabaseBaseModel";
import Route from "../../Types/API/Route";
import URL from "../../Types/API/URL";
import ColumnAccessControl from "../../Types/Database/AccessControl/ColumnAccessControl";
import OwnedThrough from "../../Types/Database/AccessControl/OwnedThrough";
import TableAccessControl from "../../Types/Database/AccessControl/TableAccessControl";
import CanAccessIfCanReadOn from "../../Types/Database/CanAccessIfCanReadOn";
import ColumnLength from "../../Types/Database/ColumnLength";
import ColumnType from "../../Types/Database/ColumnType";
import CrudApiEndpoint from "../../Types/Database/CrudApiEndpoint";
import EnableDocumentation from "../../Types/Database/EnableDocumentation";
import EnableWorkflow from "../../Types/Database/EnableWorkflow";
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 Email from "../../Types/Email";
import IconProp from "../../Types/Icon/IconProp";
import ObjectID from "../../Types/ObjectID";
import Permission from "../../Types/Permission";
import Phone from "../../Types/Phone";
import { Column, Entity, Index, JoinColumn, JoinTable, ManyToMany, ManyToOne, } from "typeorm";
let StatusPageSubscriber = class StatusPageSubscriber extends BaseModel {
    constructor() {
        super(...arguments);
        this.project = undefined;
        this.projectId = undefined;
        this.statusPage = undefined;
        this.statusPageId = undefined;
        this.subscriberEmail = undefined;
        this.subscriberPhone = undefined;
        this.subscriberWebhook = undefined;
        this.slackIncomingWebhookUrl = undefined;
        this.slackWorkspaceName = undefined;
        this.microsoftTeamsIncomingWebhookUrl = undefined;
        this.microsoftTeamsWorkspaceName = undefined;
        this.createdByUser = undefined;
        this.createdByUserId = undefined;
        this.deletedByUser = undefined;
        this.deletedByUserId = undefined;
        this.isSubscriptionConfirmed = undefined;
        this.subscriptionConfirmationToken = undefined;
        this.isUnsubscribed = undefined;
        this.sendYouHaveSubscribedMessage = undefined;
        this.isSubscribedToAllResources = undefined;
        this.isSubscribedToAllEventTypes = undefined;
        this.statusPageResources = undefined;
        this.statusPageEventTypes = undefined;
        this.internalNote = undefined;
    }
};
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.StatusPageAdmin,
            Permission.StatusPageMember,
            Permission.CreateStatusPageSubscriber,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.StatusPageAdmin,
            Permission.StatusPageMember,
            Permission.StatusPageViewer,
            Permission.ReadStatusPageSubscriber,
        ],
        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)
], StatusPageSubscriber.prototype, "project", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.StatusPageAdmin,
            Permission.StatusPageMember,
            Permission.CreateStatusPageSubscriber,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.StatusPageAdmin,
            Permission.StatusPageMember,
            Permission.StatusPageViewer,
            Permission.ReadStatusPageSubscriber,
        ],
        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)
], StatusPageSubscriber.prototype, "projectId", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.StatusPageAdmin,
            Permission.StatusPageMember,
            Permission.CreateStatusPageSubscriber,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.StatusPageAdmin,
            Permission.StatusPageMember,
            Permission.StatusPageViewer,
            Permission.ReadStatusPageSubscriber,
        ],
        update: [],
    }),
    TableColumn({
        manyToOneRelationColumn: "statusPageId",
        type: TableColumnType.Entity,
        modelType: StatusPage,
        title: "Status Page",
        description: "Relation to Status Page Resource in which this object belongs",
    }),
    ManyToOne(() => {
        return StatusPage;
    }, {
        eager: false,
        nullable: true,
        onDelete: "CASCADE",
        orphanedRowAction: "nullify",
    }),
    JoinColumn({ name: "statusPageId" }),
    __metadata("design:type", StatusPage)
], StatusPageSubscriber.prototype, "statusPage", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.StatusPageAdmin,
            Permission.StatusPageMember,
            Permission.CreateStatusPageSubscriber,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.StatusPageAdmin,
            Permission.StatusPageMember,
            Permission.StatusPageViewer,
            Permission.ReadStatusPageSubscriber,
        ],
        update: [],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.ObjectID,
        required: true,
        title: "Status Page ID",
        description: "ID of your Status Page resource where this object belongs",
        example: "b2c3d4e5-f6a7-8901-bcde-f1234567890a",
    }),
    Column({
        type: ColumnType.ObjectID,
        nullable: false,
        transformer: ObjectID.getDatabaseTransformer(),
    }),
    __metadata("design:type", ObjectID)
], StatusPageSubscriber.prototype, "statusPageId", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.StatusPageAdmin,
            Permission.StatusPageMember,
            Permission.CreateStatusPageSubscriber,
            Permission.Public,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.StatusPageAdmin,
            Permission.StatusPageMember,
            Permission.StatusPageViewer,
            Permission.ReadStatusPageSubscriber,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.StatusPageAdmin,
            Permission.StatusPageMember,
            Permission.EditStatusPageSubscriber,
        ],
    }),
    TableColumn({
        required: false,
        type: TableColumnType.Email,
        title: "Email",
        description: "Email address of the subscriber.",
        example: "subscriber@example.com",
    }),
    Column({
        nullable: true,
        type: ColumnType.Email,
        length: ColumnLength.Email,
        transformer: Email.getDatabaseTransformer(),
    }),
    __metadata("design:type", Email)
], StatusPageSubscriber.prototype, "subscriberEmail", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.StatusPageAdmin,
            Permission.StatusPageMember,
            Permission.CreateStatusPageSubscriber,
            Permission.Public,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.StatusPageAdmin,
            Permission.StatusPageMember,
            Permission.StatusPageViewer,
            Permission.ReadStatusPageSubscriber,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.StatusPageAdmin,
            Permission.StatusPageMember,
            Permission.EditStatusPageSubscriber,
        ],
    }),
    TableColumn({
        required: false,
        type: TableColumnType.Phone,
        title: "Phone",
        description: "Phone number of subscriber",
    }),
    Column({
        nullable: true,
        type: ColumnType.Phone,
        length: ColumnLength.Phone,
        transformer: Phone.getDatabaseTransformer(),
    }),
    __metadata("design:type", Phone)
], StatusPageSubscriber.prototype, "subscriberPhone", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.StatusPageAdmin,
            Permission.StatusPageMember,
            Permission.CreateStatusPageSubscriber,
            Permission.Public,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.StatusPageAdmin,
            Permission.StatusPageMember,
            Permission.StatusPageViewer,
            Permission.ReadStatusPageSubscriber,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.StatusPageAdmin,
            Permission.StatusPageMember,
            Permission.EditStatusPageSubscriber,
        ],
    }),
    TableColumn({
        required: false,
        type: TableColumnType.ShortURL,
        title: "Webhook",
        description: "Webhook to ping when events happen on Status Page",
        example: "https://example.com/webhook",
    }),
    Column({
        nullable: true,
        type: ColumnType.ShortURL,
        transformer: URL.getDatabaseTransformer(),
    }),
    __metadata("design:type", URL)
], StatusPageSubscriber.prototype, "subscriberWebhook", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.StatusPageAdmin,
            Permission.StatusPageMember,
            Permission.CreateStatusPageSubscriber,
            Permission.Public,
        ],
        read: [],
        update: [],
    }),
    TableColumn({
        required: false,
        type: TableColumnType.ShortURL,
        title: "Slack Incoming Webhook URL",
        description: "Slack incoming webhook URL to send notifications to Slack channel",
    }),
    Column({
        nullable: true,
        type: ColumnType.ShortURL,
        transformer: URL.getDatabaseTransformer(),
    }),
    __metadata("design:type", URL)
], StatusPageSubscriber.prototype, "slackIncomingWebhookUrl", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.StatusPageAdmin,
            Permission.StatusPageMember,
            Permission.CreateStatusPageSubscriber,
            Permission.Public,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.StatusPageAdmin,
            Permission.StatusPageMember,
            Permission.StatusPageViewer,
            Permission.ReadStatusPageSubscriber,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.StatusPageAdmin,
            Permission.StatusPageMember,
            Permission.EditStatusPageSubscriber,
        ],
    }),
    TableColumn({
        required: false,
        type: TableColumnType.ShortText,
        title: "Slack Workspace Name",
        description: "Name of the Slack workspace for validation and identification",
    }),
    Column({
        nullable: true,
        type: ColumnType.ShortText,
        length: ColumnLength.ShortText,
    }),
    __metadata("design:type", String)
], StatusPageSubscriber.prototype, "slackWorkspaceName", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.StatusPageAdmin,
            Permission.StatusPageMember,
            Permission.CreateStatusPageSubscriber,
            Permission.Public,
        ],
        read: [],
        update: [],
    }),
    TableColumn({
        required: false,
        type: TableColumnType.LongURL,
        title: "Microsoft Teams Incoming Webhook URL",
        description: "Microsoft Teams incoming webhook URL to send notifications to Teams channel",
    }),
    Column({
        nullable: true,
        type: ColumnType.LongURL,
        transformer: URL.getDatabaseTransformer(),
    }),
    __metadata("design:type", URL)
], StatusPageSubscriber.prototype, "microsoftTeamsIncomingWebhookUrl", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.StatusPageAdmin,
            Permission.StatusPageMember,
            Permission.CreateStatusPageSubscriber,
            Permission.Public,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.StatusPageAdmin,
            Permission.StatusPageMember,
            Permission.StatusPageViewer,
            Permission.ReadStatusPageSubscriber,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.StatusPageAdmin,
            Permission.StatusPageMember,
            Permission.EditStatusPageSubscriber,
        ],
    }),
    TableColumn({
        required: false,
        type: TableColumnType.VeryLongText,
        title: "Microsoft Teams Workspace Name",
        description: "Name of the Microsoft Teams workspace for validation and identification",
    }),
    Column({
        nullable: true,
        type: ColumnType.VeryLongText,
    }),
    __metadata("design:type", String)
], StatusPageSubscriber.prototype, "microsoftTeamsWorkspaceName", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.StatusPageAdmin,
            Permission.StatusPageMember,
            Permission.CreateStatusPageSubscriber,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.StatusPageAdmin,
            Permission.StatusPageMember,
            Permission.StatusPageViewer,
            Permission.ReadStatusPageSubscriber,
        ],
        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)
], StatusPageSubscriber.prototype, "createdByUser", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.StatusPageAdmin,
            Permission.StatusPageMember,
            Permission.CreateStatusPageSubscriber,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.StatusPageAdmin,
            Permission.StatusPageMember,
            Permission.StatusPageViewer,
            Permission.ReadStatusPageSubscriber,
        ],
        update: [],
    }),
    TableColumn({
        type: TableColumnType.ObjectID,
        title: "Created by User ID",
        description: "User ID who created this object (if this object was created by a User)",
        example: "c3d4e5f6-a7b8-9012-cdef-234567890abc",
    }),
    Column({
        type: ColumnType.ObjectID,
        nullable: true,
        transformer: ObjectID.getDatabaseTransformer(),
    }),
    __metadata("design:type", ObjectID)
], StatusPageSubscriber.prototype, "createdByUserId", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.StatusPageAdmin,
            Permission.StatusPageMember,
            Permission.StatusPageViewer,
            Permission.ReadStatusPageSubscriber,
        ],
        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)
], StatusPageSubscriber.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)
], StatusPageSubscriber.prototype, "deletedByUserId", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.StatusPageAdmin,
            Permission.StatusPageMember,
            Permission.CreateStatusPageSubscriber,
            Permission.Public,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.StatusPageAdmin,
            Permission.StatusPageMember,
            Permission.StatusPageViewer,
            Permission.ReadStatusPageSubscriber,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.StatusPageAdmin,
            Permission.StatusPageMember,
            Permission.EditStatusPageSubscriber,
        ],
    }),
    TableColumn({
        isDefaultValueColumn: true,
        type: TableColumnType.Boolean,
        title: "Is Subscription Confirmed",
        description: "Has subscriber confirmed their subscription? (for example, by clicking on a confirmation link in an email)",
        defaultValue: false,
    }),
    Column({
        type: ColumnType.Boolean,
        default: false,
    }),
    __metadata("design:type", Boolean)
], StatusPageSubscriber.prototype, "isSubscriptionConfirmed", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.StatusPageAdmin,
            Permission.StatusPageMember,
            Permission.CreateStatusPageSubscriber,
        ],
        read: [],
        update: [],
    }),
    TableColumn({
        isDefaultValueColumn: false,
        type: TableColumnType.ShortText,
        title: "Subscription Confirmation Token",
        description: "Token used to confirm subscription. This is a random token that is sent to the subscriber's email address to confirm their subscription.",
    }),
    Column({
        type: ColumnType.ShortText,
        nullable: true,
    }),
    __metadata("design:type", String)
], StatusPageSubscriber.prototype, "subscriptionConfirmationToken", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.StatusPageAdmin,
            Permission.StatusPageMember,
            Permission.CreateStatusPageSubscriber,
            Permission.Public,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.StatusPageAdmin,
            Permission.StatusPageMember,
            Permission.StatusPageViewer,
            Permission.ReadStatusPageSubscriber,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.StatusPageAdmin,
            Permission.StatusPageMember,
            Permission.EditStatusPageSubscriber,
        ],
    }),
    TableColumn({
        isDefaultValueColumn: true,
        type: TableColumnType.Boolean,
        title: "Is Unsubscribed",
        description: "Is Subscriber Unsubscribed?",
        defaultValue: false,
    }),
    Column({
        type: ColumnType.Boolean,
        default: false,
    }),
    __metadata("design:type", Boolean)
], StatusPageSubscriber.prototype, "isUnsubscribed", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.StatusPageAdmin,
            Permission.StatusPageMember,
            Permission.CreateStatusPageSubscriber,
            Permission.Public,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.StatusPageAdmin,
            Permission.StatusPageMember,
            Permission.StatusPageViewer,
            Permission.ReadStatusPageSubscriber,
        ],
        update: [],
    }),
    TableColumn({
        isDefaultValueColumn: true,
        type: TableColumnType.Boolean,
        title: "Send You Have Subscribed Message",
        description: "Send You Have Subscribed Message when subscriber is created?",
        defaultValue: true,
    }),
    Column({
        type: ColumnType.Boolean,
        default: true,
    }),
    __metadata("design:type", Boolean)
], StatusPageSubscriber.prototype, "sendYouHaveSubscribedMessage", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.StatusPageAdmin,
            Permission.StatusPageMember,
            Permission.CreateStatusPageSubscriber,
            Permission.Public,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.StatusPageAdmin,
            Permission.StatusPageMember,
            Permission.StatusPageViewer,
            Permission.ReadStatusPageSubscriber,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.StatusPageAdmin,
            Permission.StatusPageMember,
            Permission.EditStatusPageSubscriber,
        ],
    }),
    TableColumn({
        isDefaultValueColumn: true,
        type: TableColumnType.Boolean,
        title: "Is Subscribed to All Resources",
        description: "Is Subscriber Subscribed to All Resources on this status page?",
        defaultValue: true,
    }),
    Column({
        type: ColumnType.Boolean,
        default: true,
    }),
    __metadata("design:type", Boolean)
], StatusPageSubscriber.prototype, "isSubscribedToAllResources", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.StatusPageAdmin,
            Permission.StatusPageMember,
            Permission.CreateStatusPageSubscriber,
            Permission.Public,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.StatusPageAdmin,
            Permission.StatusPageMember,
            Permission.StatusPageViewer,
            Permission.ReadStatusPageSubscriber,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.StatusPageAdmin,
            Permission.StatusPageMember,
            Permission.EditStatusPageSubscriber,
        ],
    }),
    TableColumn({
        isDefaultValueColumn: true,
        type: TableColumnType.Boolean,
        title: "Is Subscribed to All Event Types",
        description: "Is Subscriber Subscribed to All Event Types (like Incidents, Scheduled Events, Announcements) on this status page?",
        defaultValue: true,
    }),
    Column({
        type: ColumnType.Boolean,
        default: true,
    }),
    __metadata("design:type", Boolean)
], StatusPageSubscriber.prototype, "isSubscribedToAllEventTypes", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.StatusPageAdmin,
            Permission.StatusPageMember,
            Permission.CreateStatusPageSubscriber,
            Permission.Public,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.StatusPageAdmin,
            Permission.StatusPageMember,
            Permission.StatusPageViewer,
            Permission.ReadStatusPageSubscriber,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.StatusPageAdmin,
            Permission.StatusPageMember,
            Permission.EditStatusPageSubscriber,
        ],
    }),
    TableColumn({
        required: false,
        type: TableColumnType.EntityArray,
        modelType: StatusPageResource,
        title: "Subscribed to Resources",
        description: "Relation to Status Page Resources where this subscriber is subscribed to",
    }),
    ManyToMany(() => {
        return StatusPageResource;
    }, { eager: false }),
    JoinTable({
        name: "StatusPageSubscriberStatusPageResource",
        inverseJoinColumn: {
            name: "statusPageResourceId",
            referencedColumnName: "_id",
        },
        joinColumn: {
            name: "statusPageSubscriberId",
            referencedColumnName: "_id",
        },
    }),
    __metadata("design:type", Array)
], StatusPageSubscriber.prototype, "statusPageResources", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.StatusPageAdmin,
            Permission.StatusPageMember,
            Permission.CreateStatusPageSubscriber,
            Permission.Public,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.StatusPageAdmin,
            Permission.StatusPageMember,
            Permission.StatusPageViewer,
            Permission.ReadStatusPageSubscriber,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.StatusPageAdmin,
            Permission.StatusPageMember,
            Permission.EditStatusPageSubscriber,
        ],
    }),
    TableColumn({
        required: false,
        type: TableColumnType.JSON,
        title: "Subscribed to Event Types",
        description: "Which event types is the subscriber subscribed to (like Incidents, Scheduled Events, Announcements)",
    }),
    Column({
        type: ColumnType.JSON,
        nullable: true,
        default: [],
    }),
    __metadata("design:type", Array)
], StatusPageSubscriber.prototype, "statusPageEventTypes", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.StatusPageAdmin,
            Permission.StatusPageMember,
            Permission.CreateStatusPageSubscriber,
            Permission.Public,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.StatusPageAdmin,
            Permission.StatusPageMember,
            Permission.StatusPageViewer,
            Permission.ReadStatusPageSubscriber,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.StatusPageAdmin,
            Permission.StatusPageMember,
            Permission.EditStatusPageSubscriber,
        ],
    }),
    TableColumn({
        type: TableColumnType.Markdown,
        title: "Notes",
        description: "Any notes or text you would like to add to this subscriber object. This is for internal use only.",
    }),
    Column({
        type: ColumnType.Markdown,
        nullable: true,
        unique: false,
    }),
    __metadata("design:type", String)
], StatusPageSubscriber.prototype, "internalNote", void 0);
StatusPageSubscriber = __decorate([
    EnableDocumentation(),
    EnableWorkflow({
        create: true,
        delete: true,
        update: true,
        read: true,
    }),
    CanAccessIfCanReadOn("statusPage"),
    TenantColumn("projectId"),
    TableAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.StatusPageAdmin,
            Permission.StatusPageMember,
            Permission.CreateStatusPageSubscriber,
            Permission.Public,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.StatusPageAdmin,
            Permission.StatusPageMember,
            Permission.StatusPageViewer,
            Permission.ReadStatusPageSubscriber,
        ],
        delete: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.StatusPageAdmin,
            Permission.StatusPageMember,
            Permission.DeleteStatusPageSubscriber,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.StatusPageAdmin,
            Permission.StatusPageMember,
            Permission.EditStatusPageSubscriber,
        ],
    }),
    CrudApiEndpoint(new Route("/status-page-subscriber")),
    SlugifyColumn("name", "slug"),
    TableMetadata({
        tableName: "StatusPageSubscriber",
        singularName: "Status Page Subscriber",
        pluralName: "Status Page Subscribers",
        icon: IconProp.Team,
        tableDescription: "Subscriber that subscribed to your status page",
    }),
    OwnedThrough("statusPageId", StatusPage),
    Entity({
        name: "StatusPageSubscriber",
    }),
    Index(["statusPageId", "subscriberEmail"]) // Dedupe lookup on email subscribe
    ,
    Index(["statusPageId", "subscriberPhone"]) // Dedupe lookup on phone subscribe
], StatusPageSubscriber);
export default StatusPageSubscriber;
//# sourceMappingURL=StatusPageSubscriber.js.map