var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
import Project from "./Project";
import User from "./User";
import BaseModel from "./DatabaseBaseModel/DatabaseBaseModel";
import Hostname from "../../Types/API/Hostname";
import Route from "../../Types/API/Route";
import { PlanType } from "../../Types/Billing/SubscriptionPlan";
import ColumnAccessControl from "../../Types/Database/AccessControl/ColumnAccessControl";
import TableAccessControl from "../../Types/Database/AccessControl/TableAccessControl";
import TableBillingAccessControl from "../../Types/Database/AccessControl/TableBillingAccessControl";
import ColumnLength from "../../Types/Database/ColumnLength";
import ColumnType from "../../Types/Database/ColumnType";
import CrudApiEndpoint from "../../Types/Database/CrudApiEndpoint";
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 UniqueColumnBy from "../../Types/Database/UniqueColumnBy";
import Email from "../../Types/Email";
import MailTransportType from "../../Types/Email/MailTransportType";
import OAuthProviderType from "../../Types/Email/OAuthProviderType";
import SMTPAuthenticationType from "../../Types/Email/SMTPAuthenticationType";
import IconProp from "../../Types/Icon/IconProp";
import ObjectID from "../../Types/ObjectID";
import Permission from "../../Types/Permission";
import Port from "../../Types/Port";
import { Column, Entity, Index, JoinColumn, ManyToOne } from "typeorm";
let ProjectSmtpConfig = class ProjectSmtpConfig extends BaseModel {
    constructor() {
        super(...arguments);
        this.project = undefined;
        this.projectId = undefined;
        this.name = undefined;
        this.slug = undefined;
        this.description = undefined;
        this.createdByUser = undefined;
        this.createdByUserId = undefined;
        this.deletedByUser = undefined;
        this.deletedByUserId = undefined;
        /*
         * This is not required because some SMTP servers do not require authentication.
         * eg: https://learn.microsoft.com/en-us/exchange/mail-flow-best-practices/how-to-set-up-a-multifunction-device-or-application-to-send-email-using-microsoft-365-or-office-365#option-2-send-mail-directly-from-your-printer-or-application-to-microsoft-365-or-office-365-direct-send
         */
        this.username = undefined;
        this.password = undefined;
        this.hostname = undefined;
        this.port = undefined;
        this.fromEmail = undefined;
        this.fromName = undefined;
        this.secure = undefined;
        /*
         * Transport type selects how mail is actually delivered.
         * SMTP (default) uses the host/port above. HTTP-API transports (e.g. Microsoft
         * Graph) ignore host/port and call the provider's REST API directly using the
         * OAuth credentials below.
         */
        this.transportType = undefined;
        // OAuth 2.0 Configuration Fields
        this.authType = undefined;
        this.clientId = undefined;
        this.clientSecret = undefined;
        this.tokenUrl = undefined;
        this.scope = undefined;
        this.oauthProviderType = undefined;
    }
};
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.CreateProjectSMTPConfig,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.SettingsViewer,
            Permission.ReadProjectSMTPConfig,
        ],
        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)
], ProjectSmtpConfig.prototype, "project", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.CreateProjectSMTPConfig,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.SettingsViewer,
            Permission.ReadProjectSMTPConfig,
        ],
        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)
], ProjectSmtpConfig.prototype, "projectId", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.CreateProjectSMTPConfig,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.SettingsViewer,
            Permission.ReadProjectSMTPConfig,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.EditProjectSMTPConfig,
        ],
    }),
    TableColumn({
        required: true,
        type: TableColumnType.ShortText,
        canReadOnRelationQuery: true,
        example: "Production SMTP Config",
    }),
    Column({
        nullable: false,
        type: ColumnType.ShortText,
        length: ColumnLength.ShortText,
    }),
    UniqueColumnBy("projectId"),
    __metadata("design:type", String)
], ProjectSmtpConfig.prototype, "name", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.SettingsViewer,
            Permission.ReadProjectSMTPConfig,
        ],
        update: [],
    }),
    TableColumn({
        required: true,
        unique: true,
        type: TableColumnType.Slug,
        title: "Slug",
        description: "Friendly globally unique name for your object",
        computed: true,
        example: "production-smtp-config",
    }),
    Column({
        nullable: false,
        type: ColumnType.Slug,
        length: ColumnLength.Slug,
    }),
    __metadata("design:type", String)
], ProjectSmtpConfig.prototype, "slug", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.CreateProjectSMTPConfig,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.SettingsViewer,
            Permission.ReadProjectSMTPConfig,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.EditProjectSMTPConfig,
        ],
    }),
    TableColumn({
        required: false,
        type: TableColumnType.LongText,
        title: "Description",
        description: "Friendly description that will help you remember",
        example: "SMTP configuration for production environment email notifications",
    }),
    Column({
        nullable: true,
        type: ColumnType.LongText,
        length: ColumnLength.LongText,
    }),
    __metadata("design:type", String)
], ProjectSmtpConfig.prototype, "description", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.CreateProjectSMTPConfig,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.SettingsViewer,
            Permission.ReadProjectSMTPConfig,
        ],
        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)",
        example: "5f8b9c0d-e1a2-4b3c-8d5e-6f7a8b9c0d1e",
    }),
    ManyToOne(() => {
        return User;
    }, {
        eager: false,
        nullable: true,
        onDelete: "SET NULL",
        orphanedRowAction: "nullify",
    }),
    JoinColumn({ name: "createdByUserId" }),
    __metadata("design:type", User)
], ProjectSmtpConfig.prototype, "createdByUser", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.CreateProjectSMTPConfig,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.SettingsViewer,
            Permission.ReadProjectSMTPConfig,
        ],
        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: "5f8b9c0d-e1a2-4b3c-8d5e-6f7a8b9c0d1e",
    }),
    Column({
        type: ColumnType.ObjectID,
        nullable: true,
        transformer: ObjectID.getDatabaseTransformer(),
    }),
    __metadata("design:type", ObjectID)
], ProjectSmtpConfig.prototype, "createdByUserId", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.SettingsViewer,
            Permission.ReadProjectSMTPConfig,
        ],
        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: "5f8b9c0d-e1a2-4b3c-8d5e-6f7a8b9c0d1e",
    }),
    ManyToOne(() => {
        return User;
    }, {
        cascade: false,
        eager: false,
        nullable: true,
        onDelete: "SET NULL",
        orphanedRowAction: "nullify",
    }),
    JoinColumn({ name: "deletedByUserId" }),
    __metadata("design:type", User)
], ProjectSmtpConfig.prototype, "deletedByUser", void 0);
__decorate([
    ColumnAccessControl({
        create: [],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.SettingsViewer,
            Permission.ReadProjectSMTPConfig,
        ],
        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: "5f8b9c0d-e1a2-4b3c-8d5e-6f7a8b9c0d1e",
    }),
    Column({
        type: ColumnType.ObjectID,
        nullable: true,
        transformer: ObjectID.getDatabaseTransformer(),
    }),
    __metadata("design:type", ObjectID)
], ProjectSmtpConfig.prototype, "deletedByUserId", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.CreateProjectSMTPConfig,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.SettingsViewer,
            Permission.ReadProjectSMTPConfig,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.EditProjectSMTPConfig,
        ],
    }),
    TableColumn({
        required: false,
        type: TableColumnType.LongText,
        example: "smtp-user@example.com",
    }),
    Column({
        nullable: true,
        type: ColumnType.LongText,
        length: ColumnLength.LongText,
    }),
    __metadata("design:type", String)
], ProjectSmtpConfig.prototype, "username", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.CreateProjectSMTPConfig,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ReadProjectSMTPConfig,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.EditProjectSMTPConfig,
        ],
    }),
    TableColumn({
        required: false,
        type: TableColumnType.Password,
        example: "your-secure-password",
    }),
    Column({
        nullable: true,
        type: ColumnType.Password,
        length: ColumnLength.Password,
    }),
    __metadata("design:type", String)
], ProjectSmtpConfig.prototype, "password", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.CreateProjectSMTPConfig,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.SettingsViewer,
            Permission.ReadProjectSMTPConfig,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.EditProjectSMTPConfig,
        ],
    }),
    TableColumn({
        required: false,
        type: TableColumnType.ShortText,
        title: "Hostname",
        description: "SMTP server hostname. Required when Transport is SMTP. Not used by HTTP-API transports like Microsoft Graph.",
        example: "smtp.gmail.com",
    }),
    Column({
        nullable: true,
        type: ColumnType.ShortText,
        length: ColumnLength.ShortText,
        transformer: Hostname.getDatabaseTransformer(),
    }),
    __metadata("design:type", Hostname)
], ProjectSmtpConfig.prototype, "hostname", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.CreateProjectSMTPConfig,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.SettingsViewer,
            Permission.ReadProjectSMTPConfig,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.EditProjectSMTPConfig,
        ],
    }),
    TableColumn({
        required: false,
        type: TableColumnType.Number,
        title: "Port",
        description: "SMTP server port. Required when Transport is SMTP. Not used by HTTP-API transports.",
        example: 587,
    }),
    Column({
        nullable: true,
        type: ColumnType.Number,
        transformer: Port.getDatabaseTransformer(),
    }),
    __metadata("design:type", Port)
], ProjectSmtpConfig.prototype, "port", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.CreateProjectSMTPConfig,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.SettingsViewer,
            Permission.ReadProjectSMTPConfig,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.EditProjectSMTPConfig,
        ],
    }),
    TableColumn({
        required: true,
        type: TableColumnType.Email,
        example: "noreply@example.com",
    }),
    Column({
        nullable: false,
        type: ColumnType.Email,
        length: ColumnLength.Email,
        transformer: Email.getDatabaseTransformer(),
    }),
    __metadata("design:type", Email)
], ProjectSmtpConfig.prototype, "fromEmail", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.CreateProjectSMTPConfig,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.SettingsViewer,
            Permission.ReadProjectSMTPConfig,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.EditProjectSMTPConfig,
        ],
    }),
    TableColumn({
        required: true,
        type: TableColumnType.ShortText,
        example: "OneUptime Notifications",
    }),
    Column({
        nullable: false,
        type: ColumnType.ShortText,
        length: ColumnLength.ShortText,
    }),
    __metadata("design:type", String)
], ProjectSmtpConfig.prototype, "fromName", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.CreateProjectSMTPConfig,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.SettingsViewer,
            Permission.ReadProjectSMTPConfig,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.EditProjectSMTPConfig,
        ],
    }),
    TableColumn({
        required: false,
        type: TableColumnType.Boolean,
        title: "Use SSL / TLS",
        description: "Enable secure SMTP connection. Used only for SMTP transport — HTTP-API transports always use HTTPS.",
        defaultValue: true,
        example: true,
    }),
    Column({
        nullable: true,
        type: ColumnType.Boolean,
        default: true,
    }),
    __metadata("design:type", Boolean)
], ProjectSmtpConfig.prototype, "secure", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.CreateProjectSMTPConfig,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.SettingsViewer,
            Permission.ReadProjectSMTPConfig,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.EditProjectSMTPConfig,
        ],
    }),
    TableColumn({
        required: true,
        type: TableColumnType.ShortText,
        title: "Transport",
        description: "How OneUptime delivers mail for this config. 'SMTP' uses the hostname/port. 'Microsoft Graph' sends via the Microsoft Graph REST API — use this when your Microsoft 365 tenant has SMTP AUTH disabled.",
        defaultValue: MailTransportType.SMTP,
        example: "SMTP",
    }),
    Column({
        nullable: false,
        type: ColumnType.ShortText,
        length: ColumnLength.ShortText,
        default: MailTransportType.SMTP,
    }),
    __metadata("design:type", String)
], ProjectSmtpConfig.prototype, "transportType", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.CreateProjectSMTPConfig,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.SettingsViewer,
            Permission.ReadProjectSMTPConfig,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.EditProjectSMTPConfig,
        ],
    }),
    TableColumn({
        required: true,
        type: TableColumnType.ShortText,
        title: "Authentication Type",
        description: "The type of authentication to use for this SMTP server. Options: Username and Password, OAuth, or None.",
        defaultValue: SMTPAuthenticationType.UsernamePassword,
        example: "Username and Password",
    }),
    Column({
        nullable: false,
        type: ColumnType.ShortText,
        length: ColumnLength.ShortText,
        default: SMTPAuthenticationType.UsernamePassword,
    }),
    __metadata("design:type", String)
], ProjectSmtpConfig.prototype, "authType", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.CreateProjectSMTPConfig,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.SettingsViewer,
            Permission.ReadProjectSMTPConfig,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.EditProjectSMTPConfig,
        ],
    }),
    TableColumn({
        required: false,
        type: TableColumnType.ShortText,
        title: "OAuth Client ID",
        description: "The Client ID from your OAuth application registration. Required for OAuth authentication.",
        example: "12345678-1234-1234-1234-123456789012",
    }),
    Column({
        nullable: true,
        type: ColumnType.ShortText,
        length: ColumnLength.ShortText,
    }),
    __metadata("design:type", String)
], ProjectSmtpConfig.prototype, "clientId", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.CreateProjectSMTPConfig,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ReadProjectSMTPConfig,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.EditProjectSMTPConfig,
        ],
    }),
    TableColumn({
        required: false,
        type: TableColumnType.VeryLongText,
        title: "OAuth Client Secret",
        description: "The Client Secret from your OAuth application registration. Required for OAuth authentication. For Google service accounts, this is the private key from the JSON key file.",
        example: "your-client-secret",
    }),
    Column({
        nullable: true,
        type: ColumnType.VeryLongText,
    }),
    __metadata("design:type", String)
], ProjectSmtpConfig.prototype, "clientSecret", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.CreateProjectSMTPConfig,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.SettingsViewer,
            Permission.ReadProjectSMTPConfig,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.EditProjectSMTPConfig,
        ],
    }),
    TableColumn({
        required: false,
        type: TableColumnType.LongURL,
        title: "OAuth Token URL",
        description: "The OAuth token endpoint URL. For Microsoft 365: https://login.microsoftonline.com/{tenant-id}/oauth2/v2.0/token. For Google: https://oauth2.googleapis.com/token",
        example: "https://login.microsoftonline.com/your-tenant-id/oauth2/v2.0/token",
    }),
    Column({
        nullable: true,
        type: ColumnType.LongURL,
    }),
    __metadata("design:type", String)
], ProjectSmtpConfig.prototype, "tokenUrl", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.CreateProjectSMTPConfig,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.SettingsViewer,
            Permission.ReadProjectSMTPConfig,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.EditProjectSMTPConfig,
        ],
    }),
    TableColumn({
        required: false,
        type: TableColumnType.LongText,
        title: "OAuth Scope",
        description: "The OAuth scope(s) required for SMTP access. For Microsoft 365: https://outlook.office365.com/.default. For Google: https://mail.google.com/",
        example: "https://outlook.office365.com/.default",
    }),
    Column({
        nullable: true,
        type: ColumnType.LongText,
        length: ColumnLength.LongText,
    }),
    __metadata("design:type", String)
], ProjectSmtpConfig.prototype, "scope", void 0);
__decorate([
    ColumnAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.CreateProjectSMTPConfig,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.SettingsViewer,
            Permission.ReadProjectSMTPConfig,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.EditProjectSMTPConfig,
        ],
    }),
    TableColumn({
        required: false,
        type: TableColumnType.ShortText,
        title: "OAuth Provider Type",
        description: "The OAuth grant type to use. 'Client Credentials' for Microsoft 365 and most providers. 'JWT Bearer' for Google Workspace service accounts.",
        example: "Client Credentials",
    }),
    Column({
        nullable: true,
        type: ColumnType.ShortText,
        length: ColumnLength.ShortText,
    }),
    __metadata("design:type", String)
], ProjectSmtpConfig.prototype, "oauthProviderType", void 0);
ProjectSmtpConfig = __decorate([
    TableBillingAccessControl({
        create: PlanType.Growth,
        read: PlanType.Growth,
        update: PlanType.Growth,
        delete: PlanType.Growth,
    }),
    TenantColumn("projectId"),
    TableAccessControl({
        create: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.CreateProjectSMTPConfig,
        ],
        read: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.ProjectMember,
            Permission.Viewer,
            Permission.SettingsAdmin,
            Permission.SettingsMember,
            Permission.SettingsViewer,
            Permission.ReadProjectSMTPConfig,
        ],
        delete: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.DeleteProjectSMTPConfig,
        ],
        update: [
            Permission.ProjectOwner,
            Permission.ProjectAdmin,
            Permission.EditProjectSMTPConfig,
        ],
    }),
    CrudApiEndpoint(new Route("/smtp-config")),
    SlugifyColumn("name", "slug"),
    TableMetadata({
        tableName: "ProjectSMTPConfig",
        singularName: "SMTP Config",
        pluralName: "SMTP Configs",
        icon: IconProp.Email,
        tableDescription: "Manage Custom SMTP Servers for your project",
    }),
    Entity({
        name: "ProjectSMTPConfig",
    })
], ProjectSmtpConfig);
export default ProjectSmtpConfig;
//# sourceMappingURL=ProjectSmtpConfig.js.map