var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import Project from "./Project";
import Incident from "./Incident";
import Alert from "./Alert";
import Monitor from "./Monitor";
import ScheduledMaintenance from "./ScheduledMaintenance";
import StatusPage from "./StatusPage";
import StatusPageAnnouncement from "./StatusPageAnnouncement";
import User from "./User";
import OnCallDutyPolicy from "./OnCallDutyPolicy";
import OnCallDutyPolicyEscalationRule from "./OnCallDutyPolicyEscalationRule";
import OnCallDutyPolicySchedule from "./OnCallDutyPolicySchedule";
import UserOnCallLogTimeline from "./UserOnCallLogTimeline";
import Team from "./Team";
import BaseModel from "./DatabaseBaseModel/DatabaseBaseModel";
import Route from "../../Types/API/Route";
import ColumnAccessControl from "../../Types/Database/AccessControl/ColumnAccessControl";
import TableAccessControl from "../../Types/Database/AccessControl/TableAccessControl";
import ColumnLength from "../../Types/Database/ColumnLength";
import ColumnType from "../../Types/Database/ColumnType";
import CrudApiEndpoint from "../../Types/Database/CrudApiEndpoint";
import EnableDocumentation from "../../Types/Database/EnableDocumentation";
import EnableWorkflow from "../../Types/Database/EnableWorkflow";
import TableColumn from "../../Types/Database/TableColumn";
import TableColumnType from "../../Types/Database/TableColumnType";
import TableMetadata from "../../Types/Database/TableMetadata";
import TenantColumn from "../../Types/Database/TenantColumn";
import IconProp from "../../Types/Icon/IconProp";
import ObjectID from "../../Types/ObjectID";
import Permission from "../../Types/Permission";
import Phone from "../../Types/Phone";
import SmsStatus from "../../Types/SmsStatus";
import { Column, Entity, Index, JoinColumn, ManyToOne } from "typeorm";
let SmsLog = class SmsLog extends BaseModel {
    constructor() {
        super(...arguments);
        this.project = undefined;
        this.projectId = undefined;
        this.toNumber = undefined;
        this.fromNumber = undefined;
        this.smsText = undefined;
        this.statusMessage = undefined;
        this.status = undefined;
        this.errorCode = undefined;
        this.statusCallbackToken = undefined;
        this.smsCostInUSDCents = undefined;
        // Relations to resources that triggered this SMS (nullable)
        this.incident = undefined;
        this.incidentId = undefined;
        this.user = undefined;
        this.userId = undefined;
        this.alert = undefined;
        this.alertId = undefined;
        this.monitor = undefined;
        this.monitorId = undefined;
        this.scheduledMaintenance = undefined;
        this.scheduledMaintenanceId = undefined;
        this.statusPage = undefined;
        this.statusPageId = undefined;
        this.statusPageAnnouncement = undefined;
        this.statusPageAnnouncementId = undefined;
        this.onCallDutyPolicy = undefined;
        this.onCallDutyPolicyId = undefined;
        this.onCallDutyPolicyEscalationRule = undefined;
        this.onCallDutyPolicyEscalationRuleId = undefined;
        this.onCallDutyPolicySchedule = undefined;
        this.onCallDutyPolicyScheduleId = undefined;
        this.userOnCallLogTimeline = undefined;
        this.userOnCallLogTimelineId = undefined;
        this.team = undefined;
        this.teamId = undefined;
        this.deletedByUser = undefined;
        this.deletedByUserId = undefined;
    }
};
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadSmsLog,
        ],
        update: [],
    }),
    TableColumn({
        manyToOneRelationColumn: "projectId",
        type: TableColumnType.Entity,
        modelType: Project,
        title: "Project",
        description: "Relation to Project Resource in which this object belongs",
        example: "5f8b9c0d-e1a2-4b3c-8d5e-6f7a8b9c0d1e",
    }),
    ManyToOne(() => {
        return Project;
    }, {
        eager: false,
        nullable: true,
        onDelete: "CASCADE",
        orphanedRowAction: "nullify",
    }),
    JoinColumn({ name: "projectId" }),
    __metadata("design:type", Project)
], SmsLog.prototype, "project", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadSmsLog,
        ],
        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)
], SmsLog.prototype, "projectId", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadSmsLog,
        ],
        update: [],
    }),
    Index(),
    TableColumn({
        required: true,
        type: TableColumnType.Phone,
        title: "To Number",
        description: "Phone Number SMS was sent to",
        canReadOnRelationQuery: false,
        example: "+1-555-123-4567",
    }),
    Column({
        nullable: false,
        type: ColumnType.Phone,
        length: ColumnLength.Phone,
        transformer: Phone.getDatabaseTransformer(),
    }),
    __metadata("design:type", Phone)
], SmsLog.prototype, "toNumber", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadSmsLog,
        ],
        update: [],
    }),
    Index(),
    TableColumn({
        required: false, // false because we may not have a from number if you dont have a twilio config.
        type: TableColumnType.Phone,
        title: "From Number",
        description: "Phone Number SMS was sent from",
        canReadOnRelationQuery: false,
        example: "+1-555-999-8888",
    }),
    Column({
        nullable: true,
        type: ColumnType.Phone,
        length: ColumnLength.Phone,
        transformer: Phone.getDatabaseTransformer(),
    }),
    __metadata("design:type", Phone)
], SmsLog.prototype, "fromNumber", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadSmsLog,
        ],
        update: [],
    }),
    TableColumn({
        required: false,
        type: TableColumnType.VeryLongText,
        title: "SMS Text",
        description: "Text content of the message",
        canReadOnRelationQuery: false,
        example: "Alert: High CPU usage detected on your server. Please investigate immediately.",
    }),
    Column({
        nullable: true,
        type: ColumnType.VeryLongText,
    }),
    __metadata("design:type", String)
], SmsLog.prototype, "smsText", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadSmsLog,
        ],
        update: [],
    }),
    TableColumn({
        required: false,
        type: TableColumnType.LongText,
        title: "Status Message",
        description: "Status Message (if any)",
        canReadOnRelationQuery: false,
        example: "Message delivered successfully",
    }),
    Column({
        nullable: true,
        type: ColumnType.LongText,
        length: ColumnLength.LongText,
    }),
    __metadata("design:type", String)
], SmsLog.prototype, "statusMessage", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadSmsLog,
        ],
        update: [],
    }),
    TableColumn({
        required: true,
        type: TableColumnType.ShortText,
        title: "Status of the SMS",
        description: "Status of the SMS sent",
        canReadOnRelationQuery: false,
        example: "Delivered",
    }),
    Column({
        nullable: false,
        type: ColumnType.ShortText,
        length: ColumnLength.ShortText,
    }),
    __metadata("design:type", String)
], SmsLog.prototype, "status", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadSmsLog,
        ],
        update: [],
    }),
    TableColumn({
        required: false,
        type: TableColumnType.ShortText,
        title: "Provider Error Code",
        description: "Error code returned by the SMS provider (e.g. Twilio error code 30007 for carrier filtering) when the message could not be delivered.",
        canReadOnRelationQuery: false,
        example: "30007",
    }),
    Column({
        nullable: true,
        type: ColumnType.ShortText,
        length: ColumnLength.ShortText,
    }),
    __metadata("design:type", String)
], SmsLog.prototype, "errorCode", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [],
        update: [],
    }),
    TableColumn({
        required: false,
        type: TableColumnType.ShortText,
        title: "Status Callback Token",
        description: "Secret token embedded in the provider delivery-status callback URL. Used to authenticate incoming delivery-status callbacks. Never exposed via the API.",
        canReadOnRelationQuery: false,
        hideColumnInDocumentation: true,
    }),
    Column({
        nullable: true,
        type: ColumnType.ShortText,
        length: ColumnLength.ShortText,
    }),
    __metadata("design:type", String)
], SmsLog.prototype, "statusCallbackToken", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadSmsLog,
        ],
        update: [],
    }),
    TableColumn({
        required: true,
        type: TableColumnType.Number,
        title: "SMS Cost",
        description: "SMS Cost in USD Cents",
        canReadOnRelationQuery: false,
        isDefaultValueColumn: true,
        defaultValue: 0,
        example: 75,
    }),
    Column({
        nullable: false,
        default: 0,
        type: ColumnType.Number,
    }),
    __metadata("design:type", Number)
], SmsLog.prototype, "smsCostInUSDCents", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadSmsLog,
        ],
        update: [],
    }),
    TableColumn({
        manyToOneRelationColumn: "incidentId",
        type: TableColumnType.Entity,
        modelType: Incident,
        title: "Incident",
        description: "Incident associated with this SMS (if any)",
        example: "b2c3d4e5-6789-01bc-def2-234567890abc",
    }),
    ManyToOne(() => {
        return Incident;
    }, {
        eager: false,
        nullable: true,
        onDelete: "CASCADE",
        orphanedRowAction: "nullify",
    }),
    JoinColumn({ name: "incidentId" }),
    __metadata("design:type", Incident)
], SmsLog.prototype, "incident", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadSmsLog,
        ],
        update: [],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.ObjectID,
        required: false,
        canReadOnRelationQuery: true,
        title: "Incident ID",
        description: "ID of Incident associated with this SMS (if any)",
        example: "b2c3d4e5-6789-01bc-def2-234567890abc",
    }),
    Column({
        type: ColumnType.ObjectID,
        nullable: true,
        transformer: ObjectID.getDatabaseTransformer(),
    }),
    __metadata("design:type", ObjectID)
], SmsLog.prototype, "incidentId", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadSmsLog,
        ],
        update: [],
    }),
    TableColumn({
        manyToOneRelationColumn: "userId",
        type: TableColumnType.Entity,
        modelType: User,
        title: "User",
        description: "User who initiated this SMS (if any)",
        example: "c3d4e5f6-789a-12cd-ef34-3456789abcde",
    }),
    ManyToOne(() => {
        return User;
    }, {
        eager: false,
        nullable: true,
        onDelete: "CASCADE",
        orphanedRowAction: "nullify",
    }),
    JoinColumn({ name: "userId" }),
    __metadata("design:type", User)
], SmsLog.prototype, "user", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadSmsLog,
        ],
        update: [],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.ObjectID,
        required: false,
        canReadOnRelationQuery: true,
        title: "User ID",
        description: "ID of User who initiated this SMS (if any)",
        example: "c3d4e5f6-789a-12cd-ef34-3456789abcde",
    }),
    Column({
        type: ColumnType.ObjectID,
        nullable: true,
        transformer: ObjectID.getDatabaseTransformer(),
    }),
    __metadata("design:type", ObjectID)
], SmsLog.prototype, "userId", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadSmsLog,
        ],
        update: [],
    }),
    TableColumn({
        manyToOneRelationColumn: "alertId",
        type: TableColumnType.Entity,
        modelType: Alert,
        title: "Alert",
        description: "Alert associated with this SMS (if any)",
        example: "d4e5f6a7-89ab-23de-f456-456789abcdef",
    }),
    ManyToOne(() => {
        return Alert;
    }, {
        eager: false,
        nullable: true,
        onDelete: "CASCADE",
        orphanedRowAction: "nullify",
    }),
    JoinColumn({ name: "alertId" }),
    __metadata("design:type", Alert)
], SmsLog.prototype, "alert", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadSmsLog,
        ],
        update: [],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.ObjectID,
        required: false,
        canReadOnRelationQuery: true,
        title: "Alert ID",
        description: "ID of Alert associated with this SMS (if any)",
        example: "d4e5f6a7-89ab-23de-f456-456789abcdef",
    }),
    Column({
        type: ColumnType.ObjectID,
        nullable: true,
        transformer: ObjectID.getDatabaseTransformer(),
    }),
    __metadata("design:type", ObjectID)
], SmsLog.prototype, "alertId", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadSmsLog,
        ],
        update: [],
    }),
    TableColumn({
        manyToOneRelationColumn: "monitorId",
        type: TableColumnType.Entity,
        modelType: Monitor,
        title: "Monitor",
        description: "Monitor associated with this SMS (if any)",
        example: "d4e5f6a7-89ab-23de-f456-456789abcdef",
    }),
    ManyToOne(() => {
        return Monitor;
    }, {
        eager: false,
        nullable: true,
        onDelete: "CASCADE",
        orphanedRowAction: "nullify",
    }),
    JoinColumn({ name: "monitorId" }),
    __metadata("design:type", Monitor)
], SmsLog.prototype, "monitor", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadSmsLog,
        ],
        update: [],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.ObjectID,
        required: false,
        canReadOnRelationQuery: true,
        title: "Monitor ID",
        description: "ID of Monitor associated with this SMS (if any)",
        example: "d4e5f6a7-89ab-23de-f456-456789abcdef",
    }),
    Column({
        type: ColumnType.ObjectID,
        nullable: true,
        transformer: ObjectID.getDatabaseTransformer(),
    }),
    __metadata("design:type", ObjectID)
], SmsLog.prototype, "monitorId", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadSmsLog,
        ],
        update: [],
    }),
    TableColumn({
        manyToOneRelationColumn: "scheduledMaintenanceId",
        type: TableColumnType.Entity,
        modelType: ScheduledMaintenance,
        title: "Scheduled Maintenance",
        description: "Scheduled Maintenance associated with this SMS (if any)",
        example: "e5f6a7b8-9abc-34ef-5678-56789abcdef0",
    }),
    ManyToOne(() => {
        return ScheduledMaintenance;
    }, {
        eager: false,
        nullable: true,
        onDelete: "CASCADE",
        orphanedRowAction: "nullify",
    }),
    JoinColumn({ name: "scheduledMaintenanceId" }),
    __metadata("design:type", ScheduledMaintenance)
], SmsLog.prototype, "scheduledMaintenance", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadSmsLog,
        ],
        update: [],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.ObjectID,
        required: false,
        canReadOnRelationQuery: true,
        title: "Scheduled Maintenance ID",
        description: "ID of Scheduled Maintenance associated with this SMS (if any)",
        example: "e5f6a7b8-9abc-34ef-5678-56789abcdef0",
    }),
    Column({
        type: ColumnType.ObjectID,
        nullable: true,
        transformer: ObjectID.getDatabaseTransformer(),
    }),
    __metadata("design:type", ObjectID)
], SmsLog.prototype, "scheduledMaintenanceId", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadSmsLog,
        ],
        update: [],
    }),
    TableColumn({
        manyToOneRelationColumn: "statusPageId",
        type: TableColumnType.Entity,
        modelType: StatusPage,
        title: "Status Page",
        description: "Status Page associated with this SMS (if any)",
        example: "f6a7b8c9-abcd-45ef-6789-6789abcdef01",
    }),
    ManyToOne(() => {
        return StatusPage;
    }, {
        eager: false,
        nullable: true,
        onDelete: "CASCADE",
        orphanedRowAction: "nullify",
    }),
    JoinColumn({ name: "statusPageId" }),
    __metadata("design:type", StatusPage)
], SmsLog.prototype, "statusPage", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadSmsLog,
        ],
        update: [],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.ObjectID,
        required: false,
        canReadOnRelationQuery: true,
        title: "Status Page ID",
        description: "ID of Status Page associated with this SMS (if any)",
        example: "f6a7b8c9-abcd-45ef-6789-6789abcdef01",
    }),
    Column({
        type: ColumnType.ObjectID,
        nullable: true,
        transformer: ObjectID.getDatabaseTransformer(),
    }),
    __metadata("design:type", ObjectID)
], SmsLog.prototype, "statusPageId", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadSmsLog,
        ],
        update: [],
    }),
    TableColumn({
        manyToOneRelationColumn: "statusPageAnnouncementId",
        type: TableColumnType.Entity,
        modelType: StatusPageAnnouncement,
        title: "Status Page Announcement",
        description: "Status Page Announcement associated with this SMS (if any)",
        example: "a7b8c9d0-bcde-56f0-789a-789abcdef012",
    }),
    ManyToOne(() => {
        return StatusPageAnnouncement;
    }, {
        eager: false,
        nullable: true,
        onDelete: "CASCADE",
        orphanedRowAction: "nullify",
    }),
    JoinColumn({ name: "statusPageAnnouncementId" }),
    __metadata("design:type", StatusPageAnnouncement)
], SmsLog.prototype, "statusPageAnnouncement", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadSmsLog,
        ],
        update: [],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.ObjectID,
        required: false,
        canReadOnRelationQuery: true,
        title: "Status Page Announcement ID",
        description: "ID of Status Page Announcement associated with this SMS (if any)",
        example: "a7b8c9d0-bcde-56f0-789a-789abcdef012",
    }),
    Column({
        type: ColumnType.ObjectID,
        nullable: true,
        transformer: ObjectID.getDatabaseTransformer(),
    }),
    __metadata("design:type", ObjectID)
], SmsLog.prototype, "statusPageAnnouncementId", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadSmsLog,
        ],
        update: [],
    }),
    TableColumn({
        manyToOneRelationColumn: "onCallDutyPolicyId",
        type: TableColumnType.Entity,
        modelType: OnCallDutyPolicy,
        title: "On-Call Duty Policy",
        description: "On-Call Duty Policy associated with this SMS (if any)",
        example: "b8c9d0e1-cdef-67f1-89ab-89abcdef0123",
    }),
    ManyToOne(() => {
        return OnCallDutyPolicy;
    }, {
        eager: false,
        nullable: true,
        onDelete: "CASCADE",
        orphanedRowAction: "nullify",
    }),
    JoinColumn({ name: "onCallDutyPolicyId" }),
    __metadata("design:type", OnCallDutyPolicy)
], SmsLog.prototype, "onCallDutyPolicy", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadSmsLog,
        ],
        update: [],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.ObjectID,
        required: false,
        canReadOnRelationQuery: true,
        title: "On-Call Duty Policy ID",
        description: "ID of On-Call Duty Policy associated with this SMS (if any)",
        example: "b8c9d0e1-cdef-67f1-89ab-89abcdef0123",
    }),
    Column({
        type: ColumnType.ObjectID,
        nullable: true,
        transformer: ObjectID.getDatabaseTransformer(),
    }),
    __metadata("design:type", ObjectID)
], SmsLog.prototype, "onCallDutyPolicyId", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadSmsLog,
        ],
        update: [],
    }),
    TableColumn({
        manyToOneRelationColumn: "onCallDutyPolicyEscalationRuleId",
        type: TableColumnType.Entity,
        modelType: OnCallDutyPolicyEscalationRule,
        title: "On-Call Duty Policy Escalation Rule",
        description: "On-Call Duty Policy Escalation Rule associated with this SMS (if any)",
        example: "c9d0e1f2-def0-78f2-9abc-9abcdef01234",
    }),
    ManyToOne(() => {
        return OnCallDutyPolicyEscalationRule;
    }, {
        eager: false,
        nullable: true,
        onDelete: "CASCADE",
        orphanedRowAction: "nullify",
    }),
    JoinColumn({ name: "onCallDutyPolicyEscalationRuleId" }),
    __metadata("design:type", OnCallDutyPolicyEscalationRule)
], SmsLog.prototype, "onCallDutyPolicyEscalationRule", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadSmsLog,
        ],
        update: [],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.ObjectID,
        required: false,
        canReadOnRelationQuery: true,
        title: "On-Call Duty Policy Escalation Rule ID",
        description: "ID of On-Call Duty Policy Escalation Rule associated with this SMS (if any)",
        example: "c9d0e1f2-def0-78f2-9abc-9abcdef01234",
    }),
    Column({
        type: ColumnType.ObjectID,
        nullable: true,
        transformer: ObjectID.getDatabaseTransformer(),
    }),
    __metadata("design:type", ObjectID)
], SmsLog.prototype, "onCallDutyPolicyEscalationRuleId", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadSmsLog,
        ],
        update: [],
    }),
    TableColumn({
        manyToOneRelationColumn: "onCallDutyPolicyScheduleId",
        type: TableColumnType.Entity,
        modelType: OnCallDutyPolicySchedule,
        title: "On-Call Duty Policy Schedule",
        description: "On-Call Duty Policy Schedule associated with this SMS (if any)",
        example: "d0e1f2a3-ef01-89f3-abcd-abcdef012345",
    }),
    ManyToOne(() => {
        return OnCallDutyPolicySchedule;
    }, {
        eager: false,
        nullable: true,
        onDelete: "CASCADE",
        orphanedRowAction: "nullify",
    }),
    JoinColumn({ name: "onCallDutyPolicyScheduleId" }),
    __metadata("design:type", OnCallDutyPolicySchedule)
], SmsLog.prototype, "onCallDutyPolicySchedule", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadSmsLog,
        ],
        update: [],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.ObjectID,
        required: false,
        canReadOnRelationQuery: true,
        title: "On-Call Duty Policy Schedule ID",
        description: "ID of On-Call Duty Policy Schedule associated with this SMS (if any)",
        example: "d0e1f2a3-ef01-89f3-abcd-abcdef012345",
    }),
    Column({
        type: ColumnType.ObjectID,
        nullable: true,
        transformer: ObjectID.getDatabaseTransformer(),
    }),
    __metadata("design:type", ObjectID)
], SmsLog.prototype, "onCallDutyPolicyScheduleId", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadSmsLog,
        ],
        update: [],
    }),
    TableColumn({
        manyToOneRelationColumn: "userOnCallLogTimelineId",
        type: TableColumnType.Entity,
        modelType: UserOnCallLogTimeline,
        title: "User On-Call Log Timeline",
        description: "On-call notification timeline entry this SMS was sent for (if any). Lets the delivery outcome be reflected back onto the on-call log.",
        example: "f1a2b3c4-d5e6-47f8-9a0b-1c2d3e4f5a6b",
    }),
    ManyToOne(() => {
        return UserOnCallLogTimeline;
    }, {
        eager: false,
        nullable: true,
        onDelete: "CASCADE",
        orphanedRowAction: "nullify",
    }),
    JoinColumn({ name: "userOnCallLogTimelineId" }),
    __metadata("design:type", UserOnCallLogTimeline)
], SmsLog.prototype, "userOnCallLogTimeline", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadSmsLog,
        ],
        update: [],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.ObjectID,
        required: false,
        canReadOnRelationQuery: true,
        title: "User On-Call Log Timeline ID",
        description: "ID of the on-call notification timeline entry this SMS was sent for (if any).",
        example: "f1a2b3c4-d5e6-47f8-9a0b-1c2d3e4f5a6b",
    }),
    Column({
        type: ColumnType.ObjectID,
        nullable: true,
        transformer: ObjectID.getDatabaseTransformer(),
    }),
    __metadata("design:type", ObjectID)
], SmsLog.prototype, "userOnCallLogTimelineId", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadSmsLog,
        ],
        update: [],
    }),
    TableColumn({
        manyToOneRelationColumn: "teamId",
        type: TableColumnType.Entity,
        modelType: Team,
        title: "Team",
        description: "Team associated with this SMS (if any)",
        example: "e1f2a3b4-f012-9af4-bcde-bcdef0123456",
    }),
    ManyToOne(() => {
        return Team;
    }, {
        eager: false,
        nullable: true,
        onDelete: "CASCADE",
        orphanedRowAction: "nullify",
    }),
    JoinColumn({ name: "teamId" }),
    __metadata("design:type", Team)
], SmsLog.prototype, "team", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadSmsLog,
        ],
        update: [],
    }),
    Index(),
    TableColumn({
        type: TableColumnType.ObjectID,
        required: false,
        canReadOnRelationQuery: true,
        title: "Team ID",
        description: "ID of Team associated with this SMS (if any)",
        example: "e1f2a3b4-f012-9af4-bcde-bcdef0123456",
    }),
    Column({
        type: ColumnType.ObjectID,
        nullable: true,
        transformer: ObjectID.getDatabaseTransformer(),
    }),
    __metadata("design:type", ObjectID)
], SmsLog.prototype, "teamId", 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)",
        example: "f2a3b4c5-0123-abf5-cdef-cdef01234567",
    }),
    ManyToOne(() => {
        return User;
    }, {
        cascade: false,
        eager: false,
        nullable: true,
        onDelete: "SET NULL",
        orphanedRowAction: "nullify",
    }),
    JoinColumn({ name: "deletedByUserId" }),
    __metadata("design:type", User)
], SmsLog.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)",
        example: "f2a3b4c5-0123-abf5-cdef-cdef01234567",
    }),
    Column({
        type: ColumnType.ObjectID,
        nullable: true,
        transformer: ObjectID.getDatabaseTransformer(),
    }),
    __metadata("design:type", ObjectID)
], SmsLog.prototype, "deletedByUserId", void 0);
SmsLog = __decorate([
    EnableDocumentation(),
    TenantColumn("projectId"),
    TableAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.ReadSmsLog,
        ],
        delete: [],
        update: [],
    }),
    CrudApiEndpoint(new Route("/sms-log")),
    Entity({
        name: "SmsLog",
    }),
    EnableWorkflow({
        create: true,
        delete: false,
        update: false,
    }),
    TableMetadata({
        tableName: "SmsLog",
        singularName: "SMS Log",
        pluralName: "SMS Logs",
        icon: IconProp.SMS,
        tableDescription: "Logs of all the SMS sent out to all users and subscribers for this project.",
    }),
    Index(["projectId", "createdAt"]) // Notification logs table: time-range filter per project
    ,
    Index(["projectId", "status"]) // Notification logs table: status filter per project
], SmsLog);
export default SmsLog;
//# sourceMappingURL=SmsLog.js.map