using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace WorkFlowCheck.DL.Migrations
{
    /// <inheritdoc />
    public partial class Extend008 : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<int>(
                name: "NumberGenerator1Id",
                table: "CheckListTemplateHeader",
                type: "int",
                nullable: true);

            migrationBuilder.AddColumn<int>(
                name: "NumberGenerator2Id",
                table: "CheckListTemplateHeader",
                type: "int",
                nullable: true);

            migrationBuilder.InsertData(
                table: "NumberGeneratorTemplateDate",
                columns: new[] { "Id", "CurrentNumber", "LastGeneratedNumber", "Month", "NumberGeneratorTemplateId", "Year" },
                values: new object[] { 1, 0, "", 0, 1, 1 });

            migrationBuilder.UpdateData(
                table: "Users",
                keyColumn: "Id",
                keyValue: 1,
                columns: new[] { "CreatedAt", "LastModAt" },
                values: new object[] { new DateTime(2025, 3, 21, 15, 14, 11, 73, DateTimeKind.Utc).AddTicks(8912), new DateTime(2025, 3, 21, 15, 14, 11, 73, DateTimeKind.Utc).AddTicks(8916) });

            migrationBuilder.UpdateData(
                table: "Users",
                keyColumn: "Id",
                keyValue: 2,
                columns: new[] { "CreatedAt", "LastModAt" },
                values: new object[] { new DateTime(2025, 3, 21, 15, 14, 11, 84, DateTimeKind.Utc).AddTicks(9869), new DateTime(2025, 3, 21, 15, 14, 11, 84, DateTimeKind.Utc).AddTicks(9870) });

            migrationBuilder.CreateIndex(
                name: "IX_CheckListTemplateHeader_NumberGenerator1Id",
                table: "CheckListTemplateHeader",
                column: "NumberGenerator1Id");

            migrationBuilder.CreateIndex(
                name: "IX_CheckListTemplateHeader_NumberGenerator2Id",
                table: "CheckListTemplateHeader",
                column: "NumberGenerator2Id");

            migrationBuilder.AddForeignKey(
                name: "FK_CheckListTemplateHeader_NumberGeneratorTemplate_NumberGenerator1Id",
                table: "CheckListTemplateHeader",
                column: "NumberGenerator1Id",
                principalTable: "NumberGeneratorTemplate",
                principalColumn: "Id");

            migrationBuilder.AddForeignKey(
                name: "FK_CheckListTemplateHeader_NumberGeneratorTemplate_NumberGenerator2Id",
                table: "CheckListTemplateHeader",
                column: "NumberGenerator2Id",
                principalTable: "NumberGeneratorTemplate",
                principalColumn: "Id");
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_CheckListTemplateHeader_NumberGeneratorTemplate_NumberGenerator1Id",
                table: "CheckListTemplateHeader");

            migrationBuilder.DropForeignKey(
                name: "FK_CheckListTemplateHeader_NumberGeneratorTemplate_NumberGenerator2Id",
                table: "CheckListTemplateHeader");

            migrationBuilder.DropIndex(
                name: "IX_CheckListTemplateHeader_NumberGenerator1Id",
                table: "CheckListTemplateHeader");

            migrationBuilder.DropIndex(
                name: "IX_CheckListTemplateHeader_NumberGenerator2Id",
                table: "CheckListTemplateHeader");

            migrationBuilder.DeleteData(
                table: "NumberGeneratorTemplateDate",
                keyColumn: "Id",
                keyValue: 1);

            migrationBuilder.DropColumn(
                name: "NumberGenerator1Id",
                table: "CheckListTemplateHeader");

            migrationBuilder.DropColumn(
                name: "NumberGenerator2Id",
                table: "CheckListTemplateHeader");

            migrationBuilder.UpdateData(
                table: "Users",
                keyColumn: "Id",
                keyValue: 1,
                columns: new[] { "CreatedAt", "LastModAt" },
                values: new object[] { new DateTime(2025, 3, 21, 12, 14, 13, 195, DateTimeKind.Utc).AddTicks(5804), new DateTime(2025, 3, 21, 12, 14, 13, 195, DateTimeKind.Utc).AddTicks(5808) });

            migrationBuilder.UpdateData(
                table: "Users",
                keyColumn: "Id",
                keyValue: 2,
                columns: new[] { "CreatedAt", "LastModAt" },
                values: new object[] { new DateTime(2025, 3, 21, 12, 14, 13, 206, DateTimeKind.Utc).AddTicks(9653), new DateTime(2025, 3, 21, 12, 14, 13, 206, DateTimeKind.Utc).AddTicks(9657) });
        }
    }
}
