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 Label from "./Label";
import MonitorStatus from "./MonitorStatus";
import MonitorTemplate from "./MonitorTemplate";
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 OperationalResource from "../../Types/Database/AccessControl/OperationalResource";
import TableAccessControl from "../../Types/Database/AccessControl/TableAccessControl";
import AccessControlColumn from "../../Types/Database/AccessControlColumn";
import ColumnLength from "../../Types/Database/ColumnLength";
import ColumnType from "../../Types/Database/ColumnType";
import CrudApiEndpoint from "../../Types/Database/CrudApiEndpoint";
import EnableDocumentation from "../../Types/Database/EnableDocumentation";
import EnableMCP from "../../Types/Database/EnableMCP";
import EnableAuditLog from "../../Types/Database/EnableAuditLog";
import EnableWorkflow from "../../Types/Database/EnableWorkflow";
import SlugifyColumn from "../../Types/Database/SlugifyColumn";
import TableColumn from "../../Types/Database/TableColumn";
import TableColumnType from "../../Types/Database/TableColumnType";
import TableMetadata from "../../Types/Database/TableMetadata";
import TenantColumn from "../../Types/Database/TenantColumn";
import IconProp from "../../Types/Icon/IconProp";
import MonitorSteps from "../../Types/Monitor/MonitorSteps";
import MonitorType from "../../Types/Monitor/MonitorType";
import ObjectID from "../../Types/ObjectID";
import Permission from "../../Types/Permission";
import { Column, Entity, Index, JoinColumn, JoinTable, ManyToMany, ManyToOne, } from "typeorm";
let Monitor = class Monitor extends BaseModel {
    constructor() {
        super(...arguments);
        this.project = undefined;
        this.projectId = undefined;
        this.name = undefined;
        this.description = undefined;
        this.slug = undefined;
        this.createdByUser = undefined;
        this.createdByUserId = undefined;
        this.deletedByUser = undefined;
        this.deletedByUserId = undefined;
        this.labels = undefined;
        this.monitorTemplate = undefined;
        this.monitorTemplateId = undefined;
        this.monitorType = undefined;
        this.currentMonitorStatus = undefined;
        this.currentMonitorStatusId = undefined;
        this.monitorSteps = undefined;
        this.monitoringInterval = undefined;
        this.customFields = undefined;
        this.isOwnerNotifiedOfResourceCreation = undefined;
        this.disableActiveMonitoring = undefined;
        this.incomingRequestMonitorHeartbeatCheckedAt = undefined;
        this.telemetryMonitorNextMonitorAt = undefined;
        this.telemetryMonitorLastMonitorAt = undefined;
        this.disableActiveMonitoringBecauseOfScheduledMaintenanceEvent = undefined;
        this.disableActiveMonitoringBecauseOfManualIncident = undefined;
        this.serverMonitorRequestReceivedAt = undefined;
        this.serverMonitorSecretKey = undefined;
        this.incomingRequestSecretKey = undefined;
        // this is for incoming request monitor.
        this.incomingMonitorRequest = undefined;
        // Incoming Email Monitor fields
        this.incomingEmailSecretKey = undefined;
        this.incomingEmailMonitorLastEmailReceivedAt = undefined;
        this.incomingEmailMonitorRequest = undefined;
        this.incomingEmailMonitorHeartbeatCheckedAt = undefined;
        this.serverMonitorResponse = undefined;
        this.isAllProbesDisconnectedFromThisMonitor = undefined;
        this.isNoProbeEnabledOnThisMonitor = undefined;
        this.minimumProbeAgreement = undefined;
        this.postUpdatesToWorkspaceChannels = undefined;
    }
};
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.CreateProjectMonitor,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.MonitorViewer,
            Permission.ReadProjectMonitor,
        ],
        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)
], Monitor.prototype, "project", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.CreateProjectMonitor,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.MonitorViewer,
            Permission.ReadProjectMonitor,
        ],
        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)
], Monitor.prototype, "projectId", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.CreateProjectMonitor,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.MonitorViewer,
            Permission.ReadProjectMonitor,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.EditProjectMonitor,
        ],
    }),
    Index(),
    TableColumn({
        required: true,
        type: TableColumnType.ShortText,
        title: "Name",
        description: "Any friendly name for this monitor",
        canReadOnRelationQuery: true,
        example: "Production API Server",
    }),
    Column({
        nullable: false,
        type: ColumnType.ShortText,
        length: ColumnLength.ShortText,
    }),
    __metadata("design:type", String)
], Monitor.prototype, "name", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.CreateProjectMonitor,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.MonitorViewer,
            Permission.ReadProjectMonitor,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.EditProjectMonitor,
        ],
    }),
    TableColumn({
        required: false,
        type: TableColumnType.LongText,
        title: "Description",
        description: "Friendly description that will help you remember",
        example: "Monitors the health and availability of our main production API server",
    }),
    Column({
        nullable: true,
        type: ColumnType.LongText,
        length: ColumnLength.LongText,
    }),
    __metadata("design:type", String)
], Monitor.prototype, "description", void 0);
__decorate([
    Index(),
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.MonitorViewer,
            Permission.ReadProjectMonitor,
        ],
        update: [],
    }),
    TableColumn({
        required: true,
        unique: true,
        type: TableColumnType.Slug,
        computed: true,
        title: "Slug",
        description: "Friendly globally unique name for your object",
        example: "production-api-server",
    }),
    Column({
        nullable: false,
        type: ColumnType.Slug,
        length: ColumnLength.Slug,
        unique: true,
    }),
    __metadata("design:type", String)
], Monitor.prototype, "slug", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.CreateProjectMonitor,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.MonitorViewer,
            Permission.ReadProjectMonitor,
        ],
        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)
], Monitor.prototype, "createdByUser", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.CreateProjectMonitor,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.MonitorViewer,
            Permission.ReadProjectMonitor,
        ],
        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)
], Monitor.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)
], Monitor.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)
], Monitor.prototype, "deletedByUserId", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.CreateProjectMonitor,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.MonitorViewer,
            Permission.ReadProjectMonitor,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.EditProjectMonitor,
        ],
    }),
    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: "MonitorLabel",
        inverseJoinColumn: {
            name: "labelId",
            referencedColumnName: "_id",
        },
        joinColumn: {
            name: "monitorId",
            referencedColumnName: "_id",
        },
    }),
    __metadata("design:type", Array)
], Monitor.prototype, "labels", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.CreateProjectMonitor,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.MonitorViewer,
            Permission.ReadProjectMonitor,
        ],
        update: [],
    }),
    TableColumn({
        manyToOneRelationColumn: "monitorTemplateId",
        type: TableColumnType.Entity,
        modelType: MonitorTemplate,
        title: "Monitor Template",
        description: "Template this monitor was created from. Used to sync configuration changes from the template to monitors created from it.",
    }),
    ManyToOne(() => {
        return MonitorTemplate;
    }, {
        eager: false,
        nullable: true,
        onDelete: "SET NULL",
        orphanedRowAction: "nullify",
    }),
    JoinColumn({ name: "monitorTemplateId" }),
    __metadata("design:type", MonitorTemplate)
], Monitor.prototype, "monitorTemplate", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.CreateProjectMonitor,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.MonitorViewer,
            Permission.ReadProjectMonitor,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.EditProjectMonitor,
        ],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.ObjectID,
        required: false,
        canReadOnRelationQuery: true,
        title: "Monitor Template ID",
        description: "ID of the Monitor Template this monitor was created from. Null for monitors not created from a template.",
    }),
    Column({
        type: ColumnType.ObjectID,
        nullable: true,
        transformer: ObjectID.getDatabaseTransformer(),
    }),
    __metadata("design:type", ObjectID)
], Monitor.prototype, "monitorTemplateId", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.CreateProjectMonitor,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.MonitorViewer,
            Permission.ReadProjectMonitor,
        ],
        update: [],
    }),
    TableColumn({
        required: true,
        type: TableColumnType.MonitorType,
        title: "Monitor Type",
        description: "What is the type of this monitor? Website? API? etc.",
        example: "API",
        canReadOnRelationQuery: true,
    }),
    Column({
        nullable: false,
        type: ColumnType.ShortText,
        length: ColumnLength.ShortText,
    }),
    __metadata("design:type", String)
], Monitor.prototype, "monitorType", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.CreateProjectMonitor,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.MonitorViewer,
            Permission.ReadProjectMonitor,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.EditProjectMonitor,
        ],
    }),
    TableColumn({
        manyToOneRelationColumn: "currentMonitorStatusId",
        type: TableColumnType.Entity,
        modelType: MonitorStatus,
        title: "Current Monitor Status",
        description: "Whats the current status of this monitor?",
    }),
    ManyToOne(() => {
        return MonitorStatus;
    }, {
        eager: false,
        nullable: true,
        orphanedRowAction: "nullify",
    }),
    JoinColumn({ name: "currentMonitorStatusId" }),
    __metadata("design:type", MonitorStatus)
], Monitor.prototype, "currentMonitorStatus", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.CreateProjectIncident,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.MonitorViewer,
            Permission.ReadProjectMonitor,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.EditProjectMonitor,
        ],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.ObjectID,
        required: true,
        isDefaultValueColumn: true,
        title: "Current Monitor Status ID",
        description: "Whats the current status ID of this monitor?",
        canReadOnRelationQuery: true,
        example: "c3d4e5f6-a7b8-9012-cdef-345678901234",
    }),
    Column({
        type: ColumnType.ObjectID,
        nullable: false,
        transformer: ObjectID.getDatabaseTransformer(),
    }),
    __metadata("design:type", ObjectID)
], Monitor.prototype, "currentMonitorStatusId", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.CreateProjectMonitor,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.MonitorViewer,
            Permission.ReadProjectMonitor,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.EditProjectMonitor,
        ],
    }),
    TableColumn({
        type: TableColumnType.MonitorSteps,
        required: false,
        title: "Monitor Steps",
        description: "What would you like to monitor and what is the criteria?",
        canReadOnRelationQuery: true,
    }),
    Column({
        type: ColumnType.JSON,
        nullable: true,
        transformer: MonitorSteps.getDatabaseTransformer(),
    }),
    __metadata("design:type", MonitorSteps)
], Monitor.prototype, "monitorSteps", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.CreateProjectMonitor,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.MonitorViewer,
            Permission.ReadProjectMonitor,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.EditProjectMonitor,
        ],
    }),
    Index(),
    TableColumn({
        required: false,
        type: TableColumnType.ShortText,
        title: "Monitoring Interval",
        description: "How often would you like OneUptime to monitor this resource?",
        example: "Every 5 minutes",
    }),
    Column({
        nullable: true,
        type: ColumnType.ShortText,
        length: ColumnLength.ShortText,
    }),
    __metadata("design:type", String)
], Monitor.prototype, "monitoringInterval", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.CreateProjectMonitor,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.MonitorViewer,
            Permission.ReadProjectMonitor,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.EditProjectMonitor,
        ],
    }),
    TableColumn({
        isDefaultValueColumn: false,
        required: false,
        type: TableColumnType.JSON,
        title: "Custom Fields",
        description: "Custom Fields on this resource.",
    }),
    Column({
        type: ColumnType.JSON,
        nullable: true,
    }),
    __metadata("design:type", Object)
], Monitor.prototype, "customFields", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.MonitorViewer,
            Permission.ReadProjectMonitor,
        ],
        update: [],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.Boolean,
        computed: true,
        hideColumnInDocumentation: true,
        required: true,
        isDefaultValueColumn: true,
        title: "Are Owners Notified Of Resource Creation?",
        description: "Are owners notified of when this resource is created?",
        defaultValue: false,
    }),
    Column({
        type: ColumnType.Boolean,
        nullable: false,
        default: false,
    }),
    __metadata("design:type", Boolean)
], Monitor.prototype, "isOwnerNotifiedOfResourceCreation", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.CreateProjectMonitor,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.MonitorViewer,
            Permission.ReadProjectMonitor,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.CreateProjectMonitor,
        ],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.Boolean,
        required: true,
        isDefaultValueColumn: true,
        title: "Disable Monitoring",
        description: "Disable active monitoring for this resource?",
        defaultValue: false,
        example: false,
    }),
    Column({
        type: ColumnType.Boolean,
        nullable: false,
        default: false,
    }),
    __metadata("design:type", Boolean)
], Monitor.prototype, "disableActiveMonitoring", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.CreateProjectMonitor,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.MonitorViewer,
            Permission.ReadProjectMonitor,
        ],
        update: [],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.Date,
        required: false,
        isDefaultValueColumn: false,
        title: "When was the last time we checked the heartbeat for incoming request?",
        description: "This field is for Incoming Request monitor only. When was the last time we checked the heartbeat?",
    }),
    Column({
        type: ColumnType.Date,
        nullable: true,
    }),
    __metadata("design:type", Date)
], Monitor.prototype, "incomingRequestMonitorHeartbeatCheckedAt", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.CreateProjectMonitor,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.MonitorViewer,
            Permission.ReadProjectMonitor,
        ],
        update: [],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.Date,
        required: false,
        isDefaultValueColumn: false,
        title: "Telemetry Monitor Next Monitor At",
        description: "This field is for Telemetry Monitor only. When is the next time we should monitor?",
    }),
    Column({
        type: ColumnType.Date,
        nullable: true,
    }),
    __metadata("design:type", Date)
], Monitor.prototype, "telemetryMonitorNextMonitorAt", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.CreateProjectMonitor,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.MonitorViewer,
            Permission.ReadProjectMonitor,
        ],
        update: [],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.Date,
        required: false,
        isDefaultValueColumn: false,
        title: "Telemetry Monitor Last Monitor At",
        description: "This field is for Telemetry Monitor only. When was the last time we monitored?",
    }),
    Column({
        type: ColumnType.Date,
        nullable: true,
    }),
    __metadata("design:type", Date)
], Monitor.prototype, "telemetryMonitorLastMonitorAt", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.MonitorViewer,
            Permission.ReadProjectMonitor,
        ],
        update: [],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.Boolean,
        required: true,
        isDefaultValueColumn: true,
        title: "Disable Monitoring because of Ongoing Scheduled Maintenance Event",
        description: "Disable Monitoring because of Ongoing Scheduled Maintenance Event",
        defaultValue: false,
    }),
    Column({
        type: ColumnType.Boolean,
        nullable: false,
        default: false,
    }),
    __metadata("design:type", Boolean)
], Monitor.prototype, "disableActiveMonitoringBecauseOfScheduledMaintenanceEvent", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.MonitorViewer,
            Permission.ReadProjectMonitor,
        ],
        update: [],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.Boolean,
        required: true,
        isDefaultValueColumn: true,
        title: "Disable Monitoring because of Manual Incident",
        description: "Disable Monitoring because of Incident which is creeated manually by user.",
        defaultValue: false,
    }),
    Column({
        type: ColumnType.Boolean,
        nullable: false,
        default: false,
    }),
    __metadata("design:type", Boolean)
], Monitor.prototype, "disableActiveMonitoringBecauseOfManualIncident", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.CreateProjectMonitor,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.MonitorViewer,
            Permission.ReadProjectMonitor,
        ],
        update: [],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.Date,
        required: false,
        isDefaultValueColumn: false,
        title: "Server Monitor Request Received At",
        description: "This field is for Server Monitor only. When was the last time we received a request?",
    }),
    Column({
        type: ColumnType.Date,
        nullable: true,
    }),
    __metadata("design:type", Date)
], Monitor.prototype, "serverMonitorRequestReceivedAt", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.MonitorViewer,
            Permission.ReadProjectMonitor,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.EditProjectMonitor,
        ],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.ObjectID,
        required: false,
        isDefaultValueColumn: false,
        computed: true,
        title: "Server Monitor Secret Key",
        description: "This field is for Server Monitor only. Secret Key to authenticate the request.",
    }),
    Column({
        type: ColumnType.ObjectID,
        nullable: true,
        transformer: ObjectID.getDatabaseTransformer(),
    }),
    __metadata("design:type", ObjectID)
], Monitor.prototype, "serverMonitorSecretKey", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.MonitorViewer,
            Permission.ReadProjectMonitor,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.EditProjectMonitor,
        ],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.ObjectID,
        required: false,
        isDefaultValueColumn: false,
        computed: true,
        title: "Incoming Request Secret Key",
        description: "This field is for Incoming Request Monitor only. Secret Key to authenticate the request.",
    }),
    Column({
        type: ColumnType.ObjectID,
        nullable: true,
        transformer: ObjectID.getDatabaseTransformer(),
    }),
    __metadata("design:type", ObjectID)
], Monitor.prototype, "incomingRequestSecretKey", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.CreateProjectMonitor,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.MonitorViewer,
            Permission.ReadProjectMonitor,
        ],
        update: [],
    }),
    TableColumn({
        type: TableColumnType.JSON,
        required: false,
        title: "Incoming Monitor Request",
        description: "Incoming Monitor Request for Incoming Request Monitor",
    }),
    Column({
        type: ColumnType.JSON,
        nullable: true,
    }),
    __metadata("design:type", Object)
], Monitor.prototype, "incomingMonitorRequest", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.MonitorViewer,
            Permission.ReadProjectMonitor,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.EditProjectMonitor,
        ],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.ObjectID,
        required: false,
        isDefaultValueColumn: false,
        computed: true,
        title: "Incoming Email Secret Key",
        description: "This field is for Incoming Email Monitor only. Secret Key used to generate unique email address.",
    }),
    Column({
        type: ColumnType.ObjectID,
        nullable: true,
        transformer: ObjectID.getDatabaseTransformer(),
    }),
    __metadata("design:type", ObjectID)
], Monitor.prototype, "incomingEmailSecretKey", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.MonitorViewer,
            Permission.ReadProjectMonitor,
        ],
        update: [],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.Date,
        required: false,
        isDefaultValueColumn: false,
        title: "Incoming Email Monitor Last Email Received At",
        description: "This field is for Incoming Email Monitor only. When was the last email received?",
    }),
    Column({
        type: ColumnType.Date,
        nullable: true,
    }),
    __metadata("design:type", Date)
], Monitor.prototype, "incomingEmailMonitorLastEmailReceivedAt", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.MonitorViewer,
            Permission.ReadProjectMonitor,
        ],
        update: [],
    }),
    TableColumn({
        type: TableColumnType.JSON,
        required: false,
        title: "Incoming Email Monitor Request",
        description: "This field is for Incoming Email Monitor only. Last email data received.",
    }),
    Column({
        type: ColumnType.JSON,
        nullable: true,
    }),
    __metadata("design:type", Object)
], Monitor.prototype, "incomingEmailMonitorRequest", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.MonitorViewer,
            Permission.ReadProjectMonitor,
        ],
        update: [],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.Date,
        required: false,
        isDefaultValueColumn: false,
        title: "When was the last time we checked the heartbeat for incoming email?",
        description: "This field is for Incoming Email monitor only. When was the last time we checked the heartbeat?",
    }),
    Column({
        type: ColumnType.Date,
        nullable: true,
    }),
    __metadata("design:type", Date)
], Monitor.prototype, "incomingEmailMonitorHeartbeatCheckedAt", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.CreateProjectMonitor,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.MonitorViewer,
            Permission.ReadProjectMonitor,
        ],
        update: [],
    }),
    TableColumn({
        type: TableColumnType.JSON,
        required: false,
        title: "Server Monitor Response",
        description: "Server Monitor Response for Server Monitor",
    }),
    Column({
        type: ColumnType.JSON,
        nullable: true,
    }),
    __metadata("design:type", Object)
], Monitor.prototype, "serverMonitorResponse", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.MonitorViewer,
            Permission.ReadProjectMonitor,
        ],
        update: [],
    }),
    TableColumn({
        type: TableColumnType.Boolean,
        required: false,
        title: "All Probes Disconnected From This Monitor",
        description: "All Probes Disconnected From This Monitor. Is this monitor not being monitored?",
        defaultValue: false,
    }),
    Column({
        type: ColumnType.Boolean,
        nullable: true,
        default: false,
    }),
    __metadata("design:type", Boolean)
], Monitor.prototype, "isAllProbesDisconnectedFromThisMonitor", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.MonitorViewer,
            Permission.ReadProjectMonitor,
        ],
        update: [],
    }),
    TableColumn({
        type: TableColumnType.Boolean,
        required: false,
        title: "No Probe Enabled On This Monitor",
        description: "No Probe Enabled On This Monitor. Is this monitor not being monitored?",
        defaultValue: false,
    }),
    Column({
        type: ColumnType.Boolean,
        nullable: true,
        default: false,
    }),
    __metadata("design:type", Boolean)
], Monitor.prototype, "isNoProbeEnabledOnThisMonitor", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.CreateProjectMonitor,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.MonitorViewer,
            Permission.ReadProjectMonitor,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.EditProjectMonitor,
        ],
    }),
    TableColumn({
        type: TableColumnType.Number,
        required: false,
        title: "Minimum Probe Agreement",
        description: "Minimum number of probes that must agree on a status before the monitor status changes. If null, all enabled and connected probes must agree.",
    }),
    Column({
        type: ColumnType.Number,
        nullable: true,
    }),
    __metadata("design:type", Number)
], Monitor.prototype, "minimumProbeAgreement", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [],
        update: [],
    }),
    TableColumn({
        isDefaultValueColumn: false,
        required: false,
        type: TableColumnType.JSON,
        title: "Post Updates To Workspace Channel Name",
        description: "Post Updates To Workspace Channel Name",
    }),
    Column({
        type: ColumnType.JSON,
        nullable: true,
    }),
    __metadata("design:type", Array)
], Monitor.prototype, "postUpdatesToWorkspaceChannels", void 0);
Monitor = __decorate([
    OperationalResource(),
    EnableDocumentation(),
    EnableMCP(),
    AccessControlColumn("labels"),
    TenantColumn("projectId"),
    TableAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.CreateProjectMonitor,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.MonitorViewer,
            Permission.ReadProjectMonitor,
        ],
        delete: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.DeleteProjectMonitor,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.MonitorAdmin,
            Permission.MonitorMember,
            Permission.EditProjectMonitor,
        ],
    }),
    EnableWorkflow({
        create: true,
        delete: true,
        update: true,
        read: true,
    }),
    EnableAuditLog(),
    CrudApiEndpoint(new Route("/monitor")),
    SlugifyColumn("name", "slug"),
    Entity({
        name: "Monitor",
    }),
    TableMetadata({
        tableName: "Monitor",
        singularName: "Monitor",
        pluralName: "Monitors",
        icon: IconProp.AltGlobe,
        tableDescription: "Monitor is anything that monitors your API, Websites, IP, Network or more. You can also create static monitor that does not monitor anything.",
    })
], Monitor);
export default Monitor;
//# sourceMappingURL=Monitor.js.map