using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional

namespace MTWorkHR.Infrastructure.Migrations
{
    /// <inheritdoc />
    public partial class leaveType : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropColumn(
                name: "CreateDate",
                table: "OrderTypes");

            migrationBuilder.DropColumn(
                name: "CreateUser",
                table: "OrderTypes");

            migrationBuilder.DropColumn(
                name: "UpdateDate",
                table: "OrderTypes");

            migrationBuilder.DropColumn(
                name: "UpdateUser",
                table: "OrderTypes");

            migrationBuilder.DropColumn(
                name: "CreateDate",
                table: "LeaveTypes");

            migrationBuilder.DropColumn(
                name: "CreateUser",
                table: "LeaveTypes");

            migrationBuilder.DropColumn(
                name: "UpdateDate",
                table: "LeaveTypes");

            migrationBuilder.DropColumn(
                name: "UpdateUser",
                table: "LeaveTypes");

            migrationBuilder.AddColumn<long>(
                name: "LeaveTypeId",
                table: "OrderAllocations",
                type: "bigint",
                nullable: true);

            migrationBuilder.InsertData(
                table: "LeaveTypes",
                columns: new[] { "Id", "DefaultDays", "NameAr", "NameEn" },
                values: new object[,]
                {
                    { 1L, 21, "أجازة سنوية", "Annual Leave" },
                    { 2L, 15, "أجازة مرضية", "Sick Leave" },
                    { 3L, 20, "أجازة زواج", "Marriage Leave" },
                    { 4L, 10, "أجازة وضع", "Paternity leave" },
                    { 5L, 10, "أجازة طارئة", "Emergency leave" }
                });

            migrationBuilder.UpdateData(
                table: "OrderTypes",
                keyColumn: "Id",
                keyValue: 2L,
                columns: new[] { "NameAr", "NameEn" },
                values: new object[] { "طبية", "Medical" });

            migrationBuilder.CreateIndex(
                name: "IX_OrderAllocations_LeaveTypeId",
                table: "OrderAllocations",
                column: "LeaveTypeId");

            migrationBuilder.AddForeignKey(
                name: "FK_OrderAllocations_LeaveTypes_LeaveTypeId",
                table: "OrderAllocations",
                column: "LeaveTypeId",
                principalTable: "LeaveTypes",
                principalColumn: "Id");
        }

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

            migrationBuilder.DropIndex(
                name: "IX_OrderAllocations_LeaveTypeId",
                table: "OrderAllocations");

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

            migrationBuilder.DeleteData(
                table: "LeaveTypes",
                keyColumn: "Id",
                keyValue: 2L);

            migrationBuilder.DeleteData(
                table: "LeaveTypes",
                keyColumn: "Id",
                keyValue: 3L);

            migrationBuilder.DeleteData(
                table: "LeaveTypes",
                keyColumn: "Id",
                keyValue: 4L);

            migrationBuilder.DeleteData(
                table: "LeaveTypes",
                keyColumn: "Id",
                keyValue: 5L);

            migrationBuilder.DropColumn(
                name: "LeaveTypeId",
                table: "OrderAllocations");

            migrationBuilder.AddColumn<DateTime>(
                name: "CreateDate",
                table: "OrderTypes",
                type: "datetime2",
                nullable: false,
                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified))
                .Annotation("Relational:ColumnOrder", 3);

            migrationBuilder.AddColumn<string>(
                name: "CreateUser",
                table: "OrderTypes",
                type: "nvarchar(450)",
                maxLength: 450,
                nullable: true)
                .Annotation("Relational:ColumnOrder", 1);

            migrationBuilder.AddColumn<DateTime>(
                name: "UpdateDate",
                table: "OrderTypes",
                type: "datetime2",
                nullable: true)
                .Annotation("Relational:ColumnOrder", 4);

            migrationBuilder.AddColumn<string>(
                name: "UpdateUser",
                table: "OrderTypes",
                type: "nvarchar(450)",
                maxLength: 450,
                nullable: true)
                .Annotation("Relational:ColumnOrder", 2);

            migrationBuilder.AddColumn<DateTime>(
                name: "CreateDate",
                table: "LeaveTypes",
                type: "datetime2",
                nullable: false,
                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified))
                .Annotation("Relational:ColumnOrder", 3);

            migrationBuilder.AddColumn<string>(
                name: "CreateUser",
                table: "LeaveTypes",
                type: "nvarchar(450)",
                maxLength: 450,
                nullable: true)
                .Annotation("Relational:ColumnOrder", 1);

            migrationBuilder.AddColumn<DateTime>(
                name: "UpdateDate",
                table: "LeaveTypes",
                type: "datetime2",
                nullable: true)
                .Annotation("Relational:ColumnOrder", 4);

            migrationBuilder.AddColumn<string>(
                name: "UpdateUser",
                table: "LeaveTypes",
                type: "nvarchar(450)",
                maxLength: 450,
                nullable: true)
                .Annotation("Relational:ColumnOrder", 2);

            migrationBuilder.UpdateData(
                table: "OrderTypes",
                keyColumn: "Id",
                keyValue: 1L,
                columns: new[] { "CreateDate", "CreateUser", "UpdateDate", "UpdateUser" },
                values: new object[] { new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), null, null, null });

            migrationBuilder.UpdateData(
                table: "OrderTypes",
                keyColumn: "Id",
                keyValue: 2L,
                columns: new[] { "CreateDate", "CreateUser", "NameAr", "NameEn", "UpdateDate", "UpdateUser" },
                values: new object[] { new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), null, "أجازة مرضية", "Sick Leave", null, null });

            migrationBuilder.UpdateData(
                table: "OrderTypes",
                keyColumn: "Id",
                keyValue: 3L,
                columns: new[] { "CreateDate", "CreateUser", "UpdateDate", "UpdateUser" },
                values: new object[] { new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), null, null, null });

            migrationBuilder.UpdateData(
                table: "OrderTypes",
                keyColumn: "Id",
                keyValue: 4L,
                columns: new[] { "CreateDate", "CreateUser", "UpdateDate", "UpdateUser" },
                values: new object[] { new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), null, null, null });

            migrationBuilder.UpdateData(
                table: "OrderTypes",
                keyColumn: "Id",
                keyValue: 5L,
                columns: new[] { "CreateDate", "CreateUser", "UpdateDate", "UpdateUser" },
                values: new object[] { new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), null, null, null });
        }
    }
}
