using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace foodmarket.Infrastructure.Persistence.Migrations
{
    /// <summary>Платформенные настройки (singleton). SMTP-креды для отправки
    /// писем (forgot-password, нотификации). Управляется SuperAdmin'ом через
    /// /super-admin/platform-settings. Видна только им.</summary>
    public partial class Phase5b_PlatformSettings : Migration
    {
        protected override void Up(MigrationBuilder b)
        {
            b.CreateTable(
                name: "platform_settings",
                schema: "public",
                columns: table => new
                {
                    Id = table.Column<System.Guid>(type: "uuid", nullable: false),
                    SmtpHost = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: true),
                    SmtpPort = table.Column<int>(type: "integer", nullable: true),
                    SmtpUseSsl = table.Column<bool>(type: "boolean", nullable: false, defaultValue: false),
                    SmtpStartTls = table.Column<bool>(type: "boolean", nullable: false, defaultValue: true),
                    SmtpUsername = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: true),
                    SmtpPasswordEncrypted = table.Column<string>(type: "text", nullable: true),
                    FromEmail = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: true),
                    FromName = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: true),
                    CreatedAt = table.Column<System.DateTime>(type: "timestamp with time zone", nullable: false),
                    UpdatedAt = table.Column<System.DateTime>(type: "timestamp with time zone", nullable: true),
                },
                constraints: table => table.PrimaryKey("PK_platform_settings", x => x.Id));
        }

        protected override void Down(MigrationBuilder b)
        {
            b.DropTable(name: "platform_settings", schema: "public");
        }
    }
}
