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 Reseller from "./Reseller";
import ResellerPlan from "./ResellerPlan";
import User from "./User";
import TenantModel from "../../Models/DatabaseModels/DatabaseBaseModel/TenantModel";
import Route from "../../Types/API/Route";
import { PlanType } from "../../Types/Billing/SubscriptionPlan";
import SubscriptionStatus from "../../Types/Billing/SubscriptionStatus";
import AllowAccessIfSubscriptionIsUnpaid from "../../Types/Database/AccessControl/AllowAccessIfSubscriptionIsUnpaid";
import ColumnAccessControl from "../../Types/Database/AccessControl/ColumnAccessControl";
import ColumnBillingAccessControl from "../../Types/Database/AccessControl/ColumnBillingAccessControl";
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 EnableDocumentation from "../../Types/Database/EnableDocumentation";
import MultiTenentQueryAllowed from "../../Types/Database/MultiTenentQueryAllowed";
import SlugifyColumn from "../../Types/Database/SlugifyColumn";
import TableColumn from "../../Types/Database/TableColumn";
import TableColumnType from "../../Types/Database/TableColumnType";
import TableMetadata from "../../Types/Database/TableMetadata";
import TenantColumn from "../../Types/Database/TenantColumn";
import Email from "../../Types/Email";
import IconProp from "../../Types/Icon/IconProp";
import Name from "../../Types/Name";
import ObjectID from "../../Types/ObjectID";
import Permission from "../../Types/Permission";
import Phone from "../../Types/Phone";
import PositiveNumber from "../../Types/PositiveNumber";
import { Column, Entity, Index, JoinColumn, ManyToOne } from "typeorm";
let Project = class Project extends TenantModel {
    constructor() {
        super(...arguments);
        this.name = undefined;
        this.slug = undefined;
        this.paymentProviderPlanId = undefined;
        this.paymentProviderSubscriptionId = undefined;
        this.paymentProviderMeteredSubscriptionId = undefined;
        this.paymentProviderSubscriptionSeats = undefined;
        this.trialEndsAt = undefined;
        this.paymentProviderCustomerId = undefined;
        this.businessDetails = undefined;
        this.businessDetailsCountry = undefined;
        this.financeAccountingEmail = undefined;
        this.paymentProviderSubscriptionStatus = undefined;
        this.paymentProviderMeteredSubscriptionStatus = undefined;
        this.paymentProviderPromoCode = undefined;
        this.createdByUser = undefined;
        this.createdByUserId = undefined;
        this.deletedByUser = undefined;
        this.deletedByUserId = undefined;
        this.isBlocked = undefined;
        this.isFeatureFlagMonitorGroupsEnabled = undefined;
        this.unpaidSubscriptionNotificationCount = undefined;
        this.paymentFailedDate = undefined;
        this.paymentSuccessDate = undefined;
        this.workflowRunsInLast30Days = undefined;
        this.requireSsoForLogin = undefined;
        this.activeMonitorsLimit = undefined;
        this.seatLimit = undefined; // this is used for stopping customers from adding more users than their plan allows. For ex: Some enterprise customers have a limit of 100 users. This is used to enforce that limit.
        this.currentActiveMonitorsCount = undefined;
        this.incidentCounter = undefined;
        this.alertCounter = undefined;
        this.scheduledMaintenanceCounter = undefined;
        this.incidentEpisodeCounter = undefined;
        this.alertEpisodeCounter = undefined;
        this.incidentNumberPrefix = undefined;
        this.alertNumberPrefix = undefined;
        this.scheduledMaintenanceNumberPrefix = undefined;
        this.incidentEpisodeNumberPrefix = undefined;
        this.alertEpisodeNumberPrefix = undefined;
        this.smsOrCallCurrentBalanceInUSDCents = undefined;
        this.autoRechargeSmsOrCallByBalanceInUSD = undefined;
        this.autoRechargeSmsOrCallWhenCurrentBalanceFallsInUSD = undefined;
        this.enableSmsNotifications = undefined;
        this.enableWhatsAppNotifications = undefined;
        this.enableTelegramNotifications = undefined;
        this.enableCallNotifications = undefined;
        this.enableAutoRechargeSmsOrCallBalance = undefined;
        this.lowCallAndSMSBalanceNotificationSentToOwners = undefined;
        this.failedCallAndSMSBalanceChargeNotificationSentToOwners = undefined;
        this.notEnabledSmsOrCallNotificationSentToOwners = undefined;
        // AI Billing Fields
        this.aiCurrentBalanceInUSDCents = undefined;
        this.autoAiRechargeByBalanceInUSD = undefined;
        this.autoRechargeAiWhenCurrentBalanceFallsInUSD = undefined;
        this.enableAi = undefined;
        this.enableAutoRechargeAiBalance = undefined;
        this.sendInvoicesByEmail = undefined;
        this.lowAiBalanceNotificationSentToOwners = undefined;
        this.failedAiBalanceChargeNotificationSentToOwners = undefined;
        this.notEnabledAiNotificationSentToOwners = undefined;
        this.planName = undefined;
        this.lastActive = undefined;
        this.createdOwnerPhone = undefined;
        this.createdOwnerEmail = undefined;
        this.createdOwnerName = undefined;
        this.utmSource = undefined;
        this.utmMedium = undefined;
        this.utmCampaign = undefined;
        this.utmTerm = undefined;
        this.utmContent = undefined;
        this.utmUrl = undefined;
        this.createdOwnerCompanyName = undefined;
        this.reseller = undefined;
        this.resellerId = undefined;
        this.resellerPlan = undefined;
        this.resellerPlanId = undefined;
        this.resellerLicenseId = undefined;
        this.enterpriseAnnualContractValue = undefined;
        this.letCustomerSupportAccessProject = undefined;
        /*
         * This is an internal field. This is used for internal analytics for example: Metabase.
         * Values can be between 0 and 100.
         */
        this.discountPercent = undefined;
        this.doNotAddGlobalProbesByDefaultOnNewMonitors = undefined;
        // GitHub App Installation ID for this project
        this.gitHubAppInstallationId = undefined;
        this.defaultMetricCardinalityBudget = undefined;
        this.defaultTelemetryRetentionInDays = undefined;
        this.telemetryRetentionConfig = undefined;
        this.defaultMetricDownsamplingRetentionDays = undefined;
        this.enableAuditLogs = undefined;
        this.auditLogsRetentionInDays = undefined;
        this.storeSystemEventsInAuditLogs = undefined;
    }
};
__decorate([
    ColumnAccessControl({
        create: [Permission.User],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadProject,
            Permission.UnAuthorizedSsoUser,
            Permission.ProjectUser,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ManageProjectBilling,
            Permission.EditProject,
        ],
    }),
    TableColumn({
        required: true,
        type: TableColumnType.ShortText,
        title: "Name",
        description: "Any friendly name of this object",
        canReadOnRelationQuery: true,
        example: "My Awesome Project",
    }),
    Column({
        nullable: false,
        type: ColumnType.ShortText,
        length: ColumnLength.ShortText,
    }),
    __metadata("design:type", String)
], Project.prototype, "name", void 0);
__decorate([
    Index(),
    ColumnAccessControl({
        create: [Permission.User],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadProject,
            Permission.UnAuthorizedSsoUser,
            Permission.ProjectUser,
        ],
        update: [],
    }),
    TableColumn({
        required: true,
        unique: true,
        type: TableColumnType.Slug,
        title: "Slug",
        description: "Friendly globally unique name for your object",
        computed: true,
    }),
    Column({
        nullable: false,
        type: ColumnType.Slug,
        length: ColumnLength.Slug,
        unique: true,
    }),
    __metadata("design:type", String)
], Project.prototype, "slug", void 0);
__decorate([
    ColumnAccessControl({
        create: [Permission.CurrentUser],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadProject,
            Permission.UnAuthorizedSsoUser,
            Permission.ProjectUser,
        ],
        update: [Permission.ProjectOwner, Permission.ManageProjectBilling],
    }),
    TableColumn({ type: TableColumnType.ShortText }),
    Column({
        type: ColumnType.ShortText,
        length: ColumnLength.ShortText,
        nullable: true,
        unique: false,
    }),
    __metadata("design:type", String)
], Project.prototype, "paymentProviderPlanId", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadProject,
            Permission.UnAuthorizedSsoUser,
            Permission.ProjectUser,
        ],
        update: [],
    }),
    TableColumn({ type: TableColumnType.ShortText }),
    Column({
        type: ColumnType.ShortText,
        length: ColumnLength.ShortText,
        nullable: true,
        unique: false,
    }),
    __metadata("design:type", String)
], Project.prototype, "paymentProviderSubscriptionId", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadProject,
            Permission.UnAuthorizedSsoUser,
            Permission.ProjectUser,
        ],
        update: [],
    }),
    TableColumn({ type: TableColumnType.ShortText }),
    Column({
        type: ColumnType.ShortText,
        length: ColumnLength.ShortText,
        nullable: true,
        unique: false,
    }),
    __metadata("design:type", String)
], Project.prototype, "paymentProviderMeteredSubscriptionId", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadProject,
            Permission.UnAuthorizedSsoUser,
            Permission.ProjectUser,
        ],
        update: [],
    }),
    TableColumn({ type: TableColumnType.Number }),
    Column({
        type: ColumnType.Number,
        nullable: true,
        unique: false,
    }),
    __metadata("design:type", Number)
], Project.prototype, "paymentProviderSubscriptionSeats", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadProject,
            Permission.UnAuthorizedSsoUser,
            Permission.ProjectUser,
        ],
        update: [],
    }),
    TableColumn({ type: TableColumnType.Date }),
    Column({
        type: ColumnType.Date,
        nullable: true,
        unique: false,
    }),
    __metadata("design:type", Date)
], Project.prototype, "trialEndsAt", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadProject,
            Permission.UnAuthorizedSsoUser,
            Permission.ProjectUser,
        ],
        update: [],
    }),
    TableColumn({ type: TableColumnType.ShortText }),
    Column({
        type: ColumnType.ShortText,
        length: ColumnLength.ShortText,
        nullable: true,
        unique: false,
    }),
    __metadata("design:type", String)
], Project.prototype, "paymentProviderCustomerId", void 0);
__decorate([
    ColumnAccessControl({
        create: [Permission.ProjectOwner, Permission.ManageProjectBilling],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadProject,
            Permission.UnAuthorizedSsoUser,
            Permission.ProjectUser,
        ],
        update: [Permission.ProjectOwner, Permission.ManageProjectBilling],
    }),
    TableColumn({
        type: TableColumnType.LongText,
        title: "Business Details / Billing Address",
        description: "Business legal name, address and any tax information to appear on invoices.",
        example: "Acme Corporation\n123 Main Street\nSan Francisco, CA 94102\nTax ID: 12-3456789",
    }),
    Column({
        type: ColumnType.LongText,
        length: ColumnLength.LongText,
        nullable: true,
        unique: false,
    }),
    __metadata("design:type", String)
], Project.prototype, "businessDetails", void 0);
__decorate([
    ColumnAccessControl({
        create: [Permission.ProjectOwner, Permission.ManageProjectBilling],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadProject,
            Permission.UnAuthorizedSsoUser,
            Permission.ProjectUser,
        ],
        update: [Permission.ProjectOwner, Permission.ManageProjectBilling],
    }),
    TableColumn({
        type: TableColumnType.ShortText,
        title: "Business Country (ISO Alpha-2)",
        description: "Two-letter ISO country code for billing address (e.g., US, GB, DE).",
        example: "US",
    }),
    Column({
        type: ColumnType.ShortText,
        length: ColumnLength.ShortText,
        nullable: true,
        unique: false,
    }),
    __metadata("design:type", String)
], Project.prototype, "businessDetailsCountry", void 0);
__decorate([
    ColumnAccessControl({
        create: [Permission.ProjectOwner, Permission.ManageProjectBilling],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadProject,
            Permission.UnAuthorizedSsoUser,
            Permission.ProjectUser,
        ],
        update: [Permission.ProjectOwner, Permission.ManageProjectBilling],
    }),
    TableColumn({
        type: TableColumnType.LongText,
        title: "Finance / Accounting Email",
        description: "Invoices, receipts and billing related notifications will be sent to these emails in addition to project owner. Separate multiple emails with a comma.",
        example: "accounting@example.com, finance@example.com",
    }),
    Column({
        type: ColumnType.LongText,
        length: ColumnLength.LongText,
        nullable: true,
        unique: false,
    }),
    __metadata("design:type", String)
], Project.prototype, "financeAccountingEmail", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadProject,
            Permission.UnAuthorizedSsoUser,
            Permission.ProjectUser,
        ],
        update: [],
    }),
    TableColumn({ type: TableColumnType.ShortText }),
    Column({
        type: ColumnType.ShortText,
        length: ColumnLength.ShortText,
        nullable: true,
        unique: false,
    }),
    __metadata("design:type", String)
], Project.prototype, "paymentProviderSubscriptionStatus", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadProject,
            Permission.UnAuthorizedSsoUser,
            Permission.ProjectUser,
        ],
        update: [],
    }),
    TableColumn({ type: TableColumnType.ShortText }),
    Column({
        type: ColumnType.ShortText,
        length: ColumnLength.ShortText,
        nullable: true,
        unique: false,
    }),
    __metadata("design:type", String)
], Project.prototype, "paymentProviderMeteredSubscriptionStatus", void 0);
__decorate([
    ColumnAccessControl({
        create: [Permission.User],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadProject,
            Permission.UnAuthorizedSsoUser,
            Permission.ProjectUser,
        ],
        update: [],
    }),
    TableColumn({ type: TableColumnType.ShortText }),
    Column({
        type: ColumnType.ShortText,
        length: ColumnLength.ShortText,
        nullable: true,
        unique: false,
    }),
    __metadata("design:type", String)
], Project.prototype, "paymentProviderPromoCode", void 0);
__decorate([
    ColumnAccessControl({
        create: [Permission.CurrentUser],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadProject,
            Permission.UnAuthorizedSsoUser,
            Permission.ProjectUser,
        ],
        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)
], Project.prototype, "createdByUser", void 0);
__decorate([
    ColumnAccessControl({
        create: [Permission.CurrentUser],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadProject,
            Permission.UnAuthorizedSsoUser,
            Permission.ProjectUser,
        ],
        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: "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    }),
    Column({
        type: ColumnType.ObjectID,
        nullable: true,
        transformer: ObjectID.getDatabaseTransformer(),
    }),
    __metadata("design:type", ObjectID)
], Project.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)
], Project.prototype, "deletedByUser", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadProject,
            Permission.UnAuthorizedSsoUser,
            Permission.ProjectUser,
        ],
        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)",
        example: "b2c3d4e5-f6a7-8901-bcde-f12345678901",
    }),
    Column({
        type: ColumnType.ObjectID,
        nullable: true,
        transformer: ObjectID.getDatabaseTransformer(),
    }),
    __metadata("design:type", ObjectID)
], Project.prototype, "deletedByUserId", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [],
        update: [],
    }),
    TableColumn({
        required: true,
        type: TableColumnType.Boolean,
        isDefaultValueColumn: true,
        defaultValue: false,
    }),
    Column({
        type: ColumnType.Boolean,
        nullable: false,
        unique: false,
        default: false,
    }),
    __metadata("design:type", Boolean)
], Project.prototype, "isBlocked", void 0);
__decorate([
    ColumnAccessControl({
        create: [Permission.User],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadProject,
            Permission.UnAuthorizedSsoUser,
            Permission.ProjectUser,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ManageProjectBilling,
            Permission.EditProject,
        ],
    }),
    TableColumn({
        required: false,
        type: TableColumnType.Boolean,
        isDefaultValueColumn: true,
        title: "Is Feature Flag Monitor Groups Enabled",
        description: "Is Feature Flag Monitor Groups Enabled",
        defaultValue: false,
    }),
    Column({
        type: ColumnType.Boolean,
        nullable: true,
        unique: false,
        default: false,
    }),
    __metadata("design:type", Boolean)
], Project.prototype, "isFeatureFlagMonitorGroupsEnabled", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [],
        update: [],
    }),
    TableColumn({ type: TableColumnType.SmallPositiveNumber, computed: true }),
    Column({
        type: ColumnType.SmallPositiveNumber,
        nullable: true,
        unique: false,
    }),
    __metadata("design:type", PositiveNumber)
], Project.prototype, "unpaidSubscriptionNotificationCount", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [],
        update: [],
    }),
    TableColumn({ type: TableColumnType.Date }),
    Column({
        type: ColumnType.Date,
        nullable: true,
        unique: false,
    }),
    __metadata("design:type", Date)
], Project.prototype, "paymentFailedDate", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [],
        update: [],
    }),
    TableColumn({ type: TableColumnType.Date }),
    Column({
        type: ColumnType.Date,
        nullable: true,
        unique: false,
    }),
    __metadata("design:type", Date)
], Project.prototype, "paymentSuccessDate", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadProject,
            Permission.UnAuthorizedSsoUser,
            Permission.ReadWorkflow,
        ],
        update: [],
    }),
    TableColumn({ type: TableColumnType.Number }),
    Column({
        type: ColumnType.Number,
        nullable: true,
        unique: false,
    }),
    __metadata("design:type", Number)
], Project.prototype, "workflowRunsInLast30Days", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadProject,
            Permission.UnAuthorizedSsoUser,
            Permission.ProjectUser,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.EditProject,
        ],
    }),
    TableColumn({
        required: true,
        type: TableColumnType.Boolean,
        isDefaultValueColumn: true,
        defaultValue: false,
    }),
    Column({
        type: ColumnType.Boolean,
        nullable: false,
        unique: false,
        default: false,
    }),
    ColumnBillingAccessControl({
        read: PlanType.Free,
        update: PlanType.Scale,
        create: PlanType.Free,
    }),
    __metadata("design:type", Boolean)
], Project.prototype, "requireSsoForLogin", void 0);
__decorate([
    ColumnAccessControl({
        create: [Permission.User],
        read: [],
        update: [],
    }),
    TableColumn({ type: TableColumnType.Number }),
    Column({
        type: ColumnType.Number,
        nullable: true,
        unique: false,
    }),
    __metadata("design:type", Number)
], Project.prototype, "activeMonitorsLimit", void 0);
__decorate([
    ColumnAccessControl({
        create: [Permission.User],
        read: [],
        update: [],
    }),
    TableColumn({ type: TableColumnType.Number }),
    Column({
        type: ColumnType.Number,
        nullable: true,
        unique: false,
    }),
    __metadata("design:type", Number)
], Project.prototype, "seatLimit", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [],
        update: [],
    }),
    TableColumn({
        type: TableColumnType.Number,
        hideColumnInDocumentation: true,
        computed: true,
    }),
    Column({
        type: ColumnType.Number,
        nullable: true,
        unique: false,
    }),
    __metadata("design:type", Number)
], Project.prototype, "currentActiveMonitorsCount", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [],
        update: [],
    }),
    TableColumn({
        type: TableColumnType.Number,
        isDefaultValueColumn: true,
        required: true,
        hideColumnInDocumentation: true,
        computed: true,
    }),
    Column({
        type: ColumnType.Number,
        nullable: false,
        unique: false,
        default: 0,
    }),
    __metadata("design:type", Number)
], Project.prototype, "incidentCounter", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [],
        update: [],
    }),
    TableColumn({
        type: TableColumnType.Number,
        isDefaultValueColumn: true,
        required: true,
        hideColumnInDocumentation: true,
        computed: true,
    }),
    Column({
        type: ColumnType.Number,
        nullable: false,
        unique: false,
        default: 0,
    }),
    __metadata("design:type", Number)
], Project.prototype, "alertCounter", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [],
        update: [],
    }),
    TableColumn({
        type: TableColumnType.Number,
        isDefaultValueColumn: true,
        required: true,
        hideColumnInDocumentation: true,
        computed: true,
    }),
    Column({
        type: ColumnType.Number,
        nullable: false,
        unique: false,
        default: 0,
    }),
    __metadata("design:type", Number)
], Project.prototype, "scheduledMaintenanceCounter", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [],
        update: [],
    }),
    TableColumn({
        type: TableColumnType.Number,
        isDefaultValueColumn: true,
        required: true,
        hideColumnInDocumentation: true,
        computed: true,
    }),
    Column({
        type: ColumnType.Number,
        nullable: false,
        unique: false,
        default: 0,
    }),
    __metadata("design:type", Number)
], Project.prototype, "incidentEpisodeCounter", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [],
        update: [],
    }),
    TableColumn({
        type: TableColumnType.Number,
        isDefaultValueColumn: true,
        required: true,
        hideColumnInDocumentation: true,
        computed: true,
    }),
    Column({
        type: ColumnType.Number,
        nullable: false,
        unique: false,
        default: 0,
    }),
    __metadata("design:type", Number)
], Project.prototype, "alertEpisodeCounter", void 0);
__decorate([
    ColumnAccessControl({
        create: [Permission.User],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadProject,
            Permission.UnAuthorizedSsoUser,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.EditProject,
        ],
    }),
    TableColumn({
        type: TableColumnType.ShortText,
        required: false,
        title: "Incident Number Prefix",
        description: "Custom prefix for incident numbers (e.g., 'INC-'). If empty, '#' is used.",
    }),
    Column({
        type: ColumnType.ShortText,
        length: ColumnLength.ShortText,
        nullable: true,
    }),
    __metadata("design:type", String)
], Project.prototype, "incidentNumberPrefix", void 0);
__decorate([
    ColumnAccessControl({
        create: [Permission.User],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadProject,
            Permission.UnAuthorizedSsoUser,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.EditProject,
        ],
    }),
    TableColumn({
        type: TableColumnType.ShortText,
        required: false,
        title: "Alert Number Prefix",
        description: "Custom prefix for alert numbers (e.g., 'ALT-'). If empty, '#' is used.",
    }),
    Column({
        type: ColumnType.ShortText,
        length: ColumnLength.ShortText,
        nullable: true,
    }),
    __metadata("design:type", String)
], Project.prototype, "alertNumberPrefix", void 0);
__decorate([
    ColumnAccessControl({
        create: [Permission.User],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadProject,
            Permission.UnAuthorizedSsoUser,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.EditProject,
        ],
    }),
    TableColumn({
        type: TableColumnType.ShortText,
        required: false,
        title: "Scheduled Maintenance Number Prefix",
        description: "Custom prefix for scheduled maintenance numbers (e.g., 'SM-'). If empty, '#' is used.",
    }),
    Column({
        type: ColumnType.ShortText,
        length: ColumnLength.ShortText,
        nullable: true,
    }),
    __metadata("design:type", String)
], Project.prototype, "scheduledMaintenanceNumberPrefix", void 0);
__decorate([
    ColumnAccessControl({
        create: [Permission.User],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadProject,
            Permission.UnAuthorizedSsoUser,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.EditProject,
        ],
    }),
    TableColumn({
        type: TableColumnType.ShortText,
        required: false,
        title: "Incident Episode Number Prefix",
        description: "Custom prefix for incident episode numbers (e.g., 'IE-'). If empty, '#' is used.",
    }),
    Column({
        type: ColumnType.ShortText,
        length: ColumnLength.ShortText,
        nullable: true,
    }),
    __metadata("design:type", String)
], Project.prototype, "incidentEpisodeNumberPrefix", void 0);
__decorate([
    ColumnAccessControl({
        create: [Permission.User],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadProject,
            Permission.UnAuthorizedSsoUser,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.EditProject,
        ],
    }),
    TableColumn({
        type: TableColumnType.ShortText,
        required: false,
        title: "Alert Episode Number Prefix",
        description: "Custom prefix for alert episode numbers (e.g., 'AE-'). If empty, '#' is used.",
    }),
    Column({
        type: ColumnType.ShortText,
        length: ColumnLength.ShortText,
        nullable: true,
    }),
    __metadata("design:type", String)
], Project.prototype, "alertEpisodeNumberPrefix", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadProject,
            Permission.UnAuthorizedSsoUser,
        ],
        update: [],
    }),
    TableColumn({
        type: TableColumnType.Number,
        isDefaultValueColumn: true,
        required: true,
        title: "SMS, Call, and WhatsApp Current Balance",
        description: "Balance in USD for SMS, Call, and WhatsApp",
        defaultValue: 0,
        example: 2500,
    }),
    Column({
        type: ColumnType.Number,
        nullable: false,
        unique: false,
        default: 0,
    }),
    __metadata("design:type", Number)
], Project.prototype, "smsOrCallCurrentBalanceInUSDCents", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadProject,
            Permission.UnAuthorizedSsoUser,
        ],
        update: [Permission.ProjectOwner, Permission.ManageProjectBilling],
    }),
    TableColumn({
        type: TableColumnType.Number,
        isDefaultValueColumn: true,
        required: true,
        title: "Auto Recharge Amount",
        description: "Auto recharge amount in USD for SMS, Call, and WhatsApp",
        defaultValue: 20,
        example: 20,
    }),
    Column({
        type: ColumnType.Number,
        nullable: false,
        unique: false,
        default: 20,
    }),
    __metadata("design:type", Number)
], Project.prototype, "autoRechargeSmsOrCallByBalanceInUSD", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadProject,
            Permission.UnAuthorizedSsoUser,
        ],
        update: [Permission.ProjectOwner, Permission.ManageProjectBilling],
    }),
    TableColumn({
        type: TableColumnType.Number,
        isDefaultValueColumn: true,
        required: true,
        title: "Auto Recharge when current balance falls to",
        description: "Auto recharge is triggered when current balance falls to this amount in USD for SMS, Call, and WhatsApp",
        defaultValue: 10,
        example: 10,
    }),
    Column({
        type: ColumnType.Number,
        nullable: false,
        unique: false,
        default: 10,
    }),
    __metadata("design:type", Number)
], Project.prototype, "autoRechargeSmsOrCallWhenCurrentBalanceFallsInUSD", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadProject,
            Permission.UnAuthorizedSsoUser,
            Permission.ProjectUser,
        ],
        update: [Permission.ProjectOwner, Permission.ManageProjectBilling],
    }),
    TableColumn({
        required: true,
        isDefaultValueColumn: true,
        type: TableColumnType.Boolean,
        title: "Enable SMS Notifications",
        description: "Enable SMS notifications for this project.",
        defaultValue: false,
        example: true,
    }),
    Column({
        nullable: false,
        default: false,
        type: ColumnType.Boolean,
    }),
    __metadata("design:type", Boolean)
], Project.prototype, "enableSmsNotifications", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadProject,
            Permission.UnAuthorizedSsoUser,
            Permission.ProjectUser,
        ],
        update: [Permission.ProjectOwner, Permission.ManageProjectBilling],
    }),
    TableColumn({
        required: true,
        isDefaultValueColumn: true,
        type: TableColumnType.Boolean,
        title: "Enable WhatsApp Notifications",
        description: "Enable WhatsApp notifications for this project.",
        defaultValue: false,
        example: false,
    }),
    Column({
        nullable: false,
        default: false,
        type: ColumnType.Boolean,
    }),
    __metadata("design:type", Boolean)
], Project.prototype, "enableWhatsAppNotifications", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadProject,
            Permission.UnAuthorizedSsoUser,
            Permission.ProjectUser,
        ],
        update: [Permission.ProjectOwner, Permission.ManageProjectBilling],
    }),
    TableColumn({
        required: true,
        isDefaultValueColumn: true,
        type: TableColumnType.Boolean,
        title: "Enable Telegram Notifications",
        description: "Enable Telegram notifications for this project.",
        defaultValue: false,
        example: false,
    }),
    Column({
        nullable: false,
        default: false,
        type: ColumnType.Boolean,
    }),
    __metadata("design:type", Boolean)
], Project.prototype, "enableTelegramNotifications", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadProject,
            Permission.UnAuthorizedSsoUser,
            Permission.ProjectUser,
        ],
        update: [Permission.ProjectOwner, Permission.ManageProjectBilling],
    }),
    TableColumn({
        required: true,
        isDefaultValueColumn: true,
        type: TableColumnType.Boolean,
        title: "Enable Call Notifications",
        description: "Enable call notifications for this project.",
        defaultValue: false,
        example: false,
    }),
    Column({
        nullable: false,
        default: false,
        type: ColumnType.Boolean,
    }),
    __metadata("design:type", Boolean)
], Project.prototype, "enableCallNotifications", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadProject,
            Permission.UnAuthorizedSsoUser,
            Permission.ProjectUser,
        ],
        update: [Permission.ProjectOwner, Permission.ManageProjectBilling],
    }),
    TableColumn({
        required: true,
        isDefaultValueColumn: true,
        type: TableColumnType.Boolean,
        title: "Enable auto recharge for SMS, Call, and WhatsApp balance",
        description: "Enable auto recharge for SMS, Call, and WhatsApp balance for this project.",
        defaultValue: false,
        example: true,
    }),
    Column({
        nullable: false,
        default: false,
        type: ColumnType.Boolean,
    }),
    __metadata("design:type", Boolean)
], Project.prototype, "enableAutoRechargeSmsOrCallBalance", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [],
        update: [],
    }),
    TableColumn({
        required: true,
        isDefaultValueColumn: true,
        hideColumnInDocumentation: true,
        type: TableColumnType.Boolean,
        title: "Low SMS, Call, and WhatsApp Balance Notification Sent to Owners",
        description: "Low SMS, Call, and WhatsApp Balance Notification Sent to Owners",
        defaultValue: false,
    }),
    Column({
        nullable: false,
        default: false,
        type: ColumnType.Boolean,
    }),
    __metadata("design:type", Boolean)
], Project.prototype, "lowCallAndSMSBalanceNotificationSentToOwners", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [],
        update: [],
    }),
    TableColumn({
        required: true,
        isDefaultValueColumn: true,
        type: TableColumnType.Boolean,
        hideColumnInDocumentation: true,
        title: "Failed SMS, Call, and WhatsApp Balance Charge Notification Sent to Owners",
        description: "Failed SMS, Call, and WhatsApp Balance Charge Notification Sent to Owners",
        defaultValue: false,
    }),
    Column({
        nullable: false,
        default: false,
        type: ColumnType.Boolean,
    }),
    __metadata("design:type", Boolean)
], Project.prototype, "failedCallAndSMSBalanceChargeNotificationSentToOwners", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [],
        update: [],
    }),
    TableColumn({
        required: true,
        isDefaultValueColumn: true,
        hideColumnInDocumentation: true,
        type: TableColumnType.Boolean,
        title: "Not Enabled SMS, Call, or WhatsApp Notification Sent to Owners",
        description: "Not Enabled SMS, Call, or WhatsApp Notification Sent to Owners",
        defaultValue: false,
    }),
    Column({
        nullable: false,
        default: false,
        type: ColumnType.Boolean,
    }),
    __metadata("design:type", Boolean)
], Project.prototype, "notEnabledSmsOrCallNotificationSentToOwners", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadProject,
            Permission.UnAuthorizedSsoUser,
        ],
        update: [],
    }),
    TableColumn({
        type: TableColumnType.Number,
        isDefaultValueColumn: true,
        required: true,
        title: "AI Current Balance",
        description: "Balance in USD for AI services",
        defaultValue: 0,
        example: 2500,
    }),
    Column({
        type: ColumnType.Number,
        nullable: false,
        unique: false,
        default: 0,
    }),
    __metadata("design:type", Number)
], Project.prototype, "aiCurrentBalanceInUSDCents", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadProject,
            Permission.UnAuthorizedSsoUser,
        ],
        update: [Permission.ProjectOwner, Permission.ManageProjectBilling],
    }),
    TableColumn({
        type: TableColumnType.Number,
        isDefaultValueColumn: true,
        required: true,
        title: "AI Auto Recharge Amount",
        description: "Auto recharge amount in USD for AI services",
        defaultValue: 20,
        example: 20,
    }),
    Column({
        type: ColumnType.Number,
        nullable: false,
        unique: false,
        default: 20,
    }),
    __metadata("design:type", Number)
], Project.prototype, "autoAiRechargeByBalanceInUSD", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadProject,
            Permission.UnAuthorizedSsoUser,
        ],
        update: [Permission.ProjectOwner, Permission.ManageProjectBilling],
    }),
    TableColumn({
        type: TableColumnType.Number,
        isDefaultValueColumn: true,
        required: true,
        title: "AI Auto Recharge when current balance falls to",
        description: "Auto recharge is triggered when current balance falls to this amount in USD for AI services",
        defaultValue: 10,
        example: 10,
    }),
    Column({
        type: ColumnType.Number,
        nullable: false,
        unique: false,
        default: 10,
    }),
    __metadata("design:type", Number)
], Project.prototype, "autoRechargeAiWhenCurrentBalanceFallsInUSD", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadProject,
            Permission.UnAuthorizedSsoUser,
            Permission.ProjectUser,
        ],
        update: [Permission.ProjectOwner, Permission.ManageProjectBilling],
    }),
    TableColumn({
        required: true,
        isDefaultValueColumn: true,
        type: TableColumnType.Boolean,
        title: "Enable AI",
        description: "Enable AI services for this project.",
        defaultValue: true,
        example: true,
    }),
    Column({
        nullable: false,
        default: true,
        type: ColumnType.Boolean,
    }),
    __metadata("design:type", Boolean)
], Project.prototype, "enableAi", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadProject,
            Permission.UnAuthorizedSsoUser,
            Permission.ProjectUser,
        ],
        update: [Permission.ProjectOwner, Permission.ManageProjectBilling],
    }),
    TableColumn({
        required: true,
        isDefaultValueColumn: true,
        type: TableColumnType.Boolean,
        title: "Enable auto recharge for AI balance",
        description: "Enable auto recharge for AI balance for this project.",
        defaultValue: false,
        example: true,
    }),
    Column({
        nullable: false,
        default: false,
        type: ColumnType.Boolean,
    }),
    __metadata("design:type", Boolean)
], Project.prototype, "enableAutoRechargeAiBalance", void 0);
__decorate([
    ColumnAccessControl({
        create: [Permission.ProjectOwner, Permission.ManageProjectBilling],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadProject,
            Permission.UnAuthorizedSsoUser,
            Permission.ProjectUser,
        ],
        update: [Permission.ProjectOwner, Permission.ManageProjectBilling],
    }),
    TableColumn({
        required: true,
        isDefaultValueColumn: true,
        type: TableColumnType.Boolean,
        title: "Send Invoices by Email",
        description: "When enabled, invoices will be automatically sent to the finance/accounting email when they are generated.",
        defaultValue: false,
        example: true,
    }),
    Column({
        nullable: false,
        default: false,
        type: ColumnType.Boolean,
    }),
    __metadata("design:type", Boolean)
], Project.prototype, "sendInvoicesByEmail", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [],
        update: [],
    }),
    TableColumn({
        required: true,
        isDefaultValueColumn: true,
        hideColumnInDocumentation: true,
        type: TableColumnType.Boolean,
        title: "Low AI Balance Notification Sent to Owners",
        description: "Low AI Balance Notification Sent to Owners",
        defaultValue: false,
    }),
    Column({
        nullable: false,
        default: false,
        type: ColumnType.Boolean,
    }),
    __metadata("design:type", Boolean)
], Project.prototype, "lowAiBalanceNotificationSentToOwners", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [],
        update: [],
    }),
    TableColumn({
        required: true,
        isDefaultValueColumn: true,
        type: TableColumnType.Boolean,
        hideColumnInDocumentation: true,
        title: "Failed AI Balance Charge Notification Sent to Owners",
        description: "Failed AI Balance Charge Notification Sent to Owners",
        defaultValue: false,
    }),
    Column({
        nullable: false,
        default: false,
        type: ColumnType.Boolean,
    }),
    __metadata("design:type", Boolean)
], Project.prototype, "failedAiBalanceChargeNotificationSentToOwners", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [],
        update: [],
    }),
    TableColumn({
        required: true,
        isDefaultValueColumn: true,
        hideColumnInDocumentation: true,
        type: TableColumnType.Boolean,
        title: "Not Enabled AI Notification Sent to Owners",
        description: "Not Enabled AI Notification Sent to Owners",
        defaultValue: false,
    }),
    Column({
        nullable: false,
        default: false,
        type: ColumnType.Boolean,
    }),
    __metadata("design:type", Boolean)
], Project.prototype, "notEnabledAiNotificationSentToOwners", void 0);
__decorate([
    ColumnAccessControl({
        create: [Permission.User],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadProject,
            Permission.UnAuthorizedSsoUser,
            Permission.ProjectUser,
        ],
        update: [],
    }),
    TableColumn({
        required: false,
        type: TableColumnType.ShortText,
        title: "Plan Name",
        description: "Name of the plan this project is subscribed to.",
        canReadOnRelationQuery: true,
        hideColumnInDocumentation: true,
    }),
    Column({
        nullable: true,
        type: ColumnType.ShortText,
        length: ColumnLength.ShortText,
    }),
    __metadata("design:type", String)
], Project.prototype, "planName", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [],
        update: [],
    }),
    TableColumn({ type: TableColumnType.Date }),
    Column({
        type: ColumnType.Date,
        nullable: true,
        unique: false,
    }),
    __metadata("design:type", Date)
], Project.prototype, "lastActive", void 0);
__decorate([
    ColumnAccessControl({
        create: [Permission.User],
        read: [],
        update: [],
    }),
    TableColumn({ type: TableColumnType.Phone, hideColumnInDocumentation: true }),
    Column({
        type: ColumnType.Phone,
        length: ColumnLength.Phone,
        nullable: true,
        unique: false,
        transformer: Phone.getDatabaseTransformer(),
    }),
    __metadata("design:type", Phone)
], Project.prototype, "createdOwnerPhone", void 0);
__decorate([
    ColumnAccessControl({
        create: [Permission.User],
        read: [],
        update: [],
    }),
    TableColumn({ type: TableColumnType.Email, hideColumnInDocumentation: true }),
    Column({
        type: ColumnType.Email,
        length: ColumnLength.Email,
        nullable: true,
        unique: false,
        transformer: Email.getDatabaseTransformer(),
    }),
    __metadata("design:type", Email)
], Project.prototype, "createdOwnerEmail", void 0);
__decorate([
    ColumnAccessControl({
        create: [Permission.User],
        read: [],
        update: [],
    }),
    TableColumn({ type: TableColumnType.Name, hideColumnInDocumentation: true }),
    Column({
        type: ColumnType.Name,
        length: ColumnLength.Name,
        nullable: true,
        unique: false,
        transformer: Name.getDatabaseTransformer(),
    }),
    __metadata("design:type", Name)
], Project.prototype, "createdOwnerName", void 0);
__decorate([
    ColumnAccessControl({
        create: [Permission.User],
        read: [],
        update: [],
    }),
    TableColumn({
        type: TableColumnType.LongText,
        hideColumnInDocumentation: true,
    }),
    Column({
        type: ColumnType.LongText,
        length: ColumnLength.LongText,
        nullable: true,
        unique: false,
    }),
    __metadata("design:type", String)
], Project.prototype, "utmSource", void 0);
__decorate([
    ColumnAccessControl({
        create: [Permission.User],
        read: [],
        update: [],
    }),
    TableColumn({
        type: TableColumnType.LongText,
        hideColumnInDocumentation: true,
    }),
    Column({
        type: ColumnType.LongText,
        length: ColumnLength.LongText,
        nullable: true,
        unique: false,
    }),
    __metadata("design:type", String)
], Project.prototype, "utmMedium", void 0);
__decorate([
    ColumnAccessControl({
        create: [Permission.User],
        read: [],
        update: [],
    }),
    TableColumn({
        type: TableColumnType.LongText,
        hideColumnInDocumentation: true,
    }),
    Column({
        type: ColumnType.LongText,
        length: ColumnLength.LongText,
        nullable: true,
        unique: false,
    }),
    __metadata("design:type", String)
], Project.prototype, "utmCampaign", void 0);
__decorate([
    ColumnAccessControl({
        create: [Permission.User],
        read: [],
        update: [],
    }),
    TableColumn({
        type: TableColumnType.LongText,
        hideColumnInDocumentation: true,
    }),
    Column({
        type: ColumnType.LongText,
        length: ColumnLength.LongText,
        nullable: true,
        unique: false,
    }),
    __metadata("design:type", String)
], Project.prototype, "utmTerm", void 0);
__decorate([
    ColumnAccessControl({
        create: [Permission.User],
        read: [],
        update: [],
    }),
    TableColumn({ type: TableColumnType.LongText }),
    Column({
        type: ColumnType.LongText,
        length: ColumnLength.LongText,
        nullable: true,
        unique: false,
    }),
    __metadata("design:type", String)
], Project.prototype, "utmContent", void 0);
__decorate([
    ColumnAccessControl({
        create: [Permission.User],
        read: [],
        update: [],
    }),
    TableColumn({
        type: TableColumnType.LongText,
        hideColumnInDocumentation: true,
    }),
    Column({
        type: ColumnType.LongText,
        length: ColumnLength.LongText,
        nullable: true,
        unique: false,
    }),
    __metadata("design:type", String)
], Project.prototype, "utmUrl", void 0);
__decorate([
    ColumnAccessControl({
        create: [Permission.User],
        read: [],
        update: [],
    }),
    TableColumn({
        type: TableColumnType.ShortText,
        hideColumnInDocumentation: true,
    }),
    Column({
        type: ColumnType.ShortText,
        length: ColumnLength.ShortText,
        nullable: true,
        unique: false,
    }),
    __metadata("design:type", String)
], Project.prototype, "createdOwnerCompanyName", void 0);
__decorate([
    ColumnAccessControl({
        create: [Permission.User],
        read: [Permission.ProjectOwner],
        update: [],
    }),
    TableColumn({
        manyToOneRelationColumn: "resellerId",
        type: TableColumnType.Entity,
        hideColumnInDocumentation: true,
        modelType: Reseller,
        title: "Reseller",
        description: "Relation to Reseller Resource in which this object belongs",
    }),
    ManyToOne(() => {
        return Reseller;
    }, {
        eager: false,
        nullable: true,
        onDelete: "CASCADE",
        orphanedRowAction: "nullify",
    }),
    JoinColumn({ name: "resellerId" }),
    __metadata("design:type", Reseller)
], Project.prototype, "reseller", void 0);
__decorate([
    ColumnAccessControl({
        create: [Permission.User],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadProject,
            Permission.UnAuthorizedSsoUser,
            Permission.ProjectUser,
        ],
        update: [],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.ObjectID,
        required: false,
        canReadOnRelationQuery: true,
        hideColumnInDocumentation: true,
        title: "Reseller ID",
        description: "ID of your OneUptime Reseller in which this object belongs",
        example: "d4e5f6a7-b8c9-0123-def0-123456789abc",
    }),
    Column({
        type: ColumnType.ObjectID,
        nullable: true,
        transformer: ObjectID.getDatabaseTransformer(),
    }),
    __metadata("design:type", ObjectID)
], Project.prototype, "resellerId", void 0);
__decorate([
    ColumnAccessControl({
        create: [Permission.User],
        read: [Permission.ProjectOwner],
        update: [],
    }),
    TableColumn({
        manyToOneRelationColumn: "ResellerPlanId",
        type: TableColumnType.Entity,
        modelType: ResellerPlan,
        hideColumnInDocumentation: true,
        title: "ResellerPlan",
        description: "Relation to ResellerPlan Resource in which this object belongs",
    }),
    ManyToOne(() => {
        return ResellerPlan;
    }, {
        eager: false,
        nullable: true,
        onDelete: "CASCADE",
        orphanedRowAction: "nullify",
    }),
    JoinColumn({ name: "resellerPlanId" }),
    __metadata("design:type", ResellerPlan)
], Project.prototype, "resellerPlan", void 0);
__decorate([
    ColumnAccessControl({
        create: [Permission.User],
        read: [Permission.ProjectOwner],
        update: [],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.ObjectID,
        required: false,
        canReadOnRelationQuery: true,
        hideColumnInDocumentation: true,
        title: "Reseller Plan ID",
        description: "ID of your OneUptime Reseller Plan in which this object belongs",
    }),
    Column({
        type: ColumnType.ObjectID,
        nullable: true,
        transformer: ObjectID.getDatabaseTransformer(),
    }),
    __metadata("design:type", ObjectID)
], Project.prototype, "resellerPlanId", void 0);
__decorate([
    ColumnAccessControl({
        create: [Permission.User],
        read: [],
        update: [],
    }),
    TableColumn({
        required: false,
        type: TableColumnType.ShortText,
        title: "License ID",
        hideColumnInDocumentation: true,
        description: "License ID from a OneUptime Reseller",
        canReadOnRelationQuery: true,
    }),
    Column({
        nullable: true,
        type: ColumnType.ShortText,
        length: ColumnLength.ShortText,
    }),
    __metadata("design:type", String)
], Project.prototype, "resellerLicenseId", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [],
        update: [],
    }),
    TableColumn({
        required: false,
        type: TableColumnType.Number,
        title: "Enterprise Annual Contract Value",
        hideColumnInDocumentation: true,
        description: "Annual contract value for this project (in USD). This field is only applicable for enterprise customers and is manually edited.",
    }),
    Column({
        nullable: true,
        type: ColumnType.Number,
    }),
    __metadata("design:type", Number)
], Project.prototype, "enterpriseAnnualContractValue", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadProject,
            Permission.UnAuthorizedSsoUser,
        ],
        update: [Permission.ProjectOwner, Permission.ProjectAdmin],
    }),
    TableColumn({
        required: false,
        type: TableColumnType.Boolean,
        title: "Let Customer Support Access Project",
        hideColumnInDocumentation: true,
        description: "OneUptime customer support can access this project. This is used for debugging purposes.",
        defaultValue: false,
    }),
    Column({
        nullable: true,
        default: false,
        type: ColumnType.Boolean,
    }),
    __metadata("design:type", Boolean)
], Project.prototype, "letCustomerSupportAccessProject", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [],
        update: [],
    }),
    TableColumn({
        required: true,
        type: TableColumnType.Number,
        isDefaultValueColumn: true,
        hideColumnInDocumentation: true,
        title: "Discount Percent",
        description: "Discount percentage applied to the project billing",
        defaultValue: 0,
    }),
    Column({
        type: ColumnType.Number,
        nullable: false,
        unique: false,
        default: 0,
    }),
    __metadata("design:type", Number)
], Project.prototype, "discountPercent", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadProject,
            Permission.UnAuthorizedSsoUser,
            Permission.ProjectUser,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.EditProject,
        ],
    }),
    TableColumn({
        required: false,
        type: TableColumnType.Boolean,
        isDefaultValueColumn: false,
        title: "Do NOT auto-add Global Probes to new monitors",
        description: "If enabled, global probes will NOT be automatically added to new monitors. Enable this only if you are using ONLY custom probes to monitor your resources.",
        defaultValue: false,
        example: false,
    }),
    Column({
        type: ColumnType.Boolean,
        nullable: false,
        unique: false,
        default: false,
    }),
    __metadata("design:type", Boolean)
], Project.prototype, "doNotAddGlobalProbesByDefaultOnNewMonitors", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadProject,
        ],
        update: [Permission.ProjectOwner, Permission.ProjectAdmin],
    }),
    TableColumn({
        required: false,
        type: TableColumnType.LongText,
        title: "GitHub App Installation ID",
        description: "The GitHub App installation ID for this project. This is set when the GitHub App is installed on the organization.",
    }),
    Column({
        type: ColumnType.LongText,
        nullable: true,
        unique: false,
    }),
    __metadata("design:type", String)
], Project.prototype, "gitHubAppInstallationId", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadProject,
        ],
        update: [Permission.ProjectOwner, Permission.ProjectAdmin],
    }),
    TableColumn({
        type: TableColumnType.Number,
        required: false,
        title: "Default Metric Cardinality Budget",
        description: "Project-wide default max distinct series per metric. Services without a per-service override use this value.",
    }),
    Column({
        type: ColumnType.Number,
        nullable: false,
        default: 10000,
    }),
    __metadata("design:type", Number)
], Project.prototype, "defaultMetricCardinalityBudget", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadProject,
        ],
        update: [Permission.ProjectOwner, Permission.ProjectAdmin],
    }),
    TableColumn({
        type: TableColumnType.Number,
        required: false,
        title: "Default Telemetry Data Retention (Days)",
        description: "Project-wide default number of days to retain telemetry data (logs, traces, metrics). Services without a per-service override use this value.",
    }),
    Column({
        type: ColumnType.Number,
        nullable: false,
        default: 15,
    }),
    __metadata("design:type", Number)
], Project.prototype, "defaultTelemetryRetentionInDays", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadProject,
        ],
        update: [Permission.ProjectOwner, Permission.ProjectAdmin],
    }),
    TableColumn({
        type: TableColumnType.JSON,
        required: false,
        title: "Telemetry Data Retention Overrides",
        description: "Project-wide per-pillar retention overrides for telemetry data (logs by severity, traces by status, metrics, profiles). Falls back to defaultTelemetryRetentionInDays when a pillar or bucket is not set.",
    }),
    Column({
        type: ColumnType.JSON,
        nullable: true,
    }),
    __metadata("design:type", Object)
], Project.prototype, "telemetryRetentionConfig", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadProject,
        ],
        update: [Permission.ProjectOwner, Permission.ProjectAdmin],
    }),
    TableColumn({
        type: TableColumnType.JSON,
        required: false,
        title: "Default Metric Downsampling Retention (days per tier)",
        description: "Project-wide default retention for each downsampling tier (raw, 1m, 5m, 1h, 1d) in days.",
    }),
    Column({
        type: ColumnType.JSON,
        nullable: true,
    }),
    __metadata("design:type", Object)
], Project.prototype, "defaultMetricDownsamplingRetentionDays", void 0);
__decorate([
    ColumnAccessControl({
        create: [Permission.User],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadProject,
            Permission.UnAuthorizedSsoUser,
            Permission.ProjectUser,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.EditProject,
        ],
    }),
    TableColumn({
        required: true,
        type: TableColumnType.Boolean,
        isDefaultValueColumn: true,
        defaultValue: false,
        title: "Enable Audit Logs",
        description: "When enabled, changes to resources in this project are recorded as audit log entries.",
    }),
    Column({
        type: ColumnType.Boolean,
        nullable: false,
        unique: false,
        default: false,
    }),
    ColumnBillingAccessControl({
        read: PlanType.Free,
        update: PlanType.Enterprise,
        create: PlanType.Free,
    }),
    __metadata("design:type", Boolean)
], Project.prototype, "enableAuditLogs", void 0);
__decorate([
    ColumnAccessControl({
        create: [Permission.User],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadProject,
            Permission.UnAuthorizedSsoUser,
            Permission.ProjectUser,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.EditProject,
        ],
    }),
    TableColumn({
        required: false,
        type: TableColumnType.Number,
        isDefaultValueColumn: true,
        defaultValue: 7,
        title: "Audit Log Retention (days)",
        description: "Number of days to retain audit log entries. Minimum 7, maximum 180.",
    }),
    Column({
        type: ColumnType.Number,
        nullable: false,
        unique: false,
        default: 7,
    }),
    ColumnBillingAccessControl({
        read: PlanType.Free,
        update: PlanType.Enterprise,
        create: PlanType.Free,
    }),
    __metadata("design:type", Number)
], Project.prototype, "auditLogsRetentionInDays", void 0);
__decorate([
    ColumnAccessControl({
        create: [Permission.User],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadProject,
            Permission.UnAuthorizedSsoUser,
            Permission.ProjectUser,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.EditProject,
        ],
    }),
    TableColumn({
        required: true,
        type: TableColumnType.Boolean,
        isDefaultValueColumn: true,
        defaultValue: false,
        title: "Store System Events",
        description: "When enabled, audit logs will also include events triggered by the system. By default, only events triggered by users are recorded.",
    }),
    Column({
        type: ColumnType.Boolean,
        nullable: false,
        unique: false,
        default: false,
    }),
    ColumnBillingAccessControl({
        read: PlanType.Free,
        update: PlanType.Enterprise,
        create: PlanType.Free,
    }),
    __metadata("design:type", Boolean)
], Project.prototype, "storeSystemEventsInAuditLogs", void 0);
Project = __decorate([
    EnableDocumentation({
        isMasterAdminApiDocs: true,
    }),
    AllowAccessIfSubscriptionIsUnpaid(),
    MultiTenentQueryAllowed(true),
    TableAccessControl({
        create: [Permission.User],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadProject,
            Permission.UnAuthorizedSsoUser,
            Permission.ProjectUser,
        ],
        delete: [Permission.ProjectOwner, Permission.DeleteProject],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ManageProjectBilling,
            Permission.EditProject,
        ],
    }),
    TableMetadata({
        tableName: "Project",
        singularName: "Project",
        pluralName: "Projects",
        icon: IconProp.Folder,
        tableDescription: "OneUptime Project, and everything happens inside it",
    }),
    CrudApiEndpoint(new Route("/project")),
    SlugifyColumn("name", "slug"),
    Entity({
        name: "Project",
    }),
    TenantColumn("_id")
], Project);
export default Project;
//# sourceMappingURL=Project.js.map