using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace BMA.EHR.Infrastructure.Migrations
{
    /// <inheritdoc />
    public partial class AddMessageQueue : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "MessageQueues",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, comment: "PrimaryKey", collation: "ascii_general_ci"),
                    CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false, comment: "สร้างข้อมูลเมื่อ"),
                    CreatedUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่สร้างข้อมูล")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    LastUpdatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: true, comment: "แก้ไขข้อมูลล่าสุดเมื่อ"),
                    LastUpdateUserId = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false, comment: "User Id ที่แก้ไขข้อมูลล่าสุด")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreatedFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่สร้างข้อมูล")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    LastUpdateFullName = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ชื่อ User ที่แก้ไขข้อมูลล่าสุด")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    SenderSystem = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "ส่งจากระบบงาน")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    Subject = table.Column<string>(type: "varchar(200)", maxLength: 200, nullable: false, comment: "หัวเรื่อง")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    MessageContent = table.Column<string>(type: "longtext", nullable: false, comment: "รายละเอียดข้อความ")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    MessagePayLoad = table.Column<string>(type: "longtext", nullable: false, comment: "สิ่งที่แนบมาด้วย")
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ReceiverUserId = table.Column<Guid>(type: "char(36)", nullable: false, comment: "รหัสของผู้รับข้อความ", collation: "ascii_general_ci"),
                    IsSendEmail = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "ส่งอีเมลล์หรือไม่?"),
                    IsSendInbox = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "ส่งไปที่กล่องข้อความหรือไม่?"),
                    IsSendNotification = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "ส่งการแจ้งเตือนหรือไม่?"),
                    IsSend = table.Column<bool>(type: "tinyint(1)", nullable: false, comment: "ทำการส่งข้อความแล้วหรือยัง?")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MessageQueues", x => x.Id);
                })
                .Annotation("MySql:CharSet", "utf8mb4");
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "MessageQueues");
        }
    }
}
