using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

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

namespace GreadyPoang.DataLayer.Migrations
{
    /// <inheritdoc />
    public partial class AddedTableGameRounds : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<int>(
                name: "PointStatus",
                table: "GamePoints",
                type: "INTEGER",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.CreateTable(
                name: "GameRounds",
                columns: table => new
                {
                    GameRoundId = table.Column<int>(type: "INTEGER", nullable: false)
                        .Annotation("Sqlite:Autoincrement", true),
                    GameRoundFinished = table.Column<DateTime>(type: "TEXT", nullable: true),
                    GameRoundStartDate = table.Column<DateTime>(type: "TEXT", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_GameRounds", x => x.GameRoundId);
                });

            migrationBuilder.UpdateData(
                table: "GamePoints",
                keyColumn: "GamePointId",
                keyValue: 1,
                columns: new[] { "GameRoundId", "PointStatus" },
                values: new object[] { 2, 0 });

            migrationBuilder.UpdateData(
                table: "GamePoints",
                keyColumn: "GamePointId",
                keyValue: 2,
                columns: new[] { "GameRoundId", "PointStatus" },
                values: new object[] { 2, 0 });

            migrationBuilder.UpdateData(
                table: "GamePoints",
                keyColumn: "GamePointId",
                keyValue: 3,
                columns: new[] { "GameRoundId", "PointStatus" },
                values: new object[] { 2, 0 });

            migrationBuilder.UpdateData(
                table: "GamePoints",
                keyColumn: "GamePointId",
                keyValue: 4,
                columns: new[] { "GameRoundId", "PointStatus" },
                values: new object[] { 2, 0 });

            migrationBuilder.InsertData(
                table: "GameRounds",
                columns: new[] { "GameRoundId", "GameRoundFinished", "GameRoundStartDate" },
                values: new object[,]
                {
                    { 1, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new DateTime(2025, 10, 15, 19, 10, 15, 0, DateTimeKind.Unspecified) },
                    { 2, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new DateTime(2025, 9, 15, 19, 10, 15, 0, DateTimeKind.Unspecified) },
                    { 3, new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), new DateTime(2025, 9, 20, 19, 10, 15, 0, DateTimeKind.Unspecified) }
                });
        }

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

            migrationBuilder.DropColumn(
                name: "PointStatus",
                table: "GamePoints");

            migrationBuilder.UpdateData(
                table: "GamePoints",
                keyColumn: "GamePointId",
                keyValue: 1,
                column: "GameRoundId",
                value: 0);

            migrationBuilder.UpdateData(
                table: "GamePoints",
                keyColumn: "GamePointId",
                keyValue: 2,
                column: "GameRoundId",
                value: 0);

            migrationBuilder.UpdateData(
                table: "GamePoints",
                keyColumn: "GamePointId",
                keyValue: 3,
                column: "GameRoundId",
                value: 0);

            migrationBuilder.UpdateData(
                table: "GamePoints",
                keyColumn: "GamePointId",
                keyValue: 4,
                column: "GameRoundId",
                value: 0);
        }
    }
}
