using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace RR3CommunityServer.Migrations
{
    /// <inheritdoc />
    public partial class AddMissingColumns : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<long>(
                name: "CompressedSize",
                table: "GameAssets",
                type: "INTEGER",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "CustomAuthor",
                table: "GameAssets",
                type: "TEXT",
                nullable: true);

            migrationBuilder.AddColumn<bool>(
                name: "IsCustomContent",
                table: "GameAssets",
                type: "INTEGER",
                nullable: false,
                defaultValue: false);

            migrationBuilder.AddColumn<string>(
                name: "Md5Hash",
                table: "GameAssets",
                type: "TEXT",
                nullable: true);

            migrationBuilder.AddColumn<DateTime>(
                name: "CreatedAt",
                table: "Cars",
                type: "TEXT",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "CustomAuthor",
                table: "Cars",
                type: "TEXT",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "CustomVersion",
                table: "Cars",
                type: "TEXT",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "Description",
                table: "Cars",
                type: "TEXT",
                nullable: true);

            migrationBuilder.AddColumn<bool>(
                name: "IsCustom",
                table: "Cars",
                type: "INTEGER",
                nullable: false,
                defaultValue: false);

            migrationBuilder.AddColumn<int>(
                name: "Year",
                table: "Cars",
                type: "INTEGER",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.CreateTable(
                name: "ModPacks",
                columns: table => new
                {
                    Id = table.Column<int>(type: "INTEGER", nullable: false)
                        .Annotation("Sqlite:Autoincrement", true),
                    PackId = table.Column<string>(type: "TEXT", nullable: false),
                    Name = table.Column<string>(type: "TEXT", nullable: false),
                    Author = table.Column<string>(type: "TEXT", nullable: false),
                    Description = table.Column<string>(type: "TEXT", nullable: true),
                    Version = table.Column<string>(type: "TEXT", nullable: false),
                    CarIds = table.Column<string>(type: "TEXT", nullable: true),
                    TrackIds = table.Column<string>(type: "TEXT", nullable: true),
                    DownloadCount = table.Column<int>(type: "INTEGER", nullable: false),
                    Rating = table.Column<double>(type: "REAL", nullable: false),
                    CreatedAt = table.Column<DateTime>(type: "TEXT", nullable: false),
                    UpdatedAt = table.Column<DateTime>(type: "TEXT", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ModPacks", x => x.Id);
                });

            migrationBuilder.UpdateData(
                table: "Cars",
                keyColumn: "Id",
                keyValue: 1,
                columns: new[] { "CreatedAt", "CustomAuthor", "CustomVersion", "Description", "IsCustom", "Year" },
                values: new object[] { null, null, null, null, false, 0 });

            migrationBuilder.UpdateData(
                table: "Cars",
                keyColumn: "Id",
                keyValue: 2,
                columns: new[] { "CreatedAt", "CustomAuthor", "CustomVersion", "Description", "IsCustom", "Year" },
                values: new object[] { null, null, null, null, false, 0 });

            migrationBuilder.UpdateData(
                table: "Cars",
                keyColumn: "Id",
                keyValue: 3,
                columns: new[] { "CreatedAt", "CustomAuthor", "CustomVersion", "Description", "IsCustom", "Year" },
                values: new object[] { null, null, null, null, false, 0 });

            migrationBuilder.UpdateData(
                table: "Cars",
                keyColumn: "Id",
                keyValue: 4,
                columns: new[] { "CreatedAt", "CustomAuthor", "CustomVersion", "Description", "IsCustom", "Year" },
                values: new object[] { null, null, null, null, false, 0 });

            migrationBuilder.UpdateData(
                table: "Cars",
                keyColumn: "Id",
                keyValue: 5,
                columns: new[] { "CreatedAt", "CustomAuthor", "CustomVersion", "Description", "IsCustom", "Year" },
                values: new object[] { null, null, null, null, false, 0 });

            migrationBuilder.UpdateData(
                table: "TimeTrials",
                keyColumn: "Id",
                keyValue: 1,
                columns: new[] { "EndDate", "StartDate" },
                values: new object[] { new DateTime(2026, 2, 25, 9, 51, 0, 392, DateTimeKind.Utc).AddTicks(5137), new DateTime(2026, 2, 18, 9, 51, 0, 392, DateTimeKind.Utc).AddTicks(5134) });

            migrationBuilder.UpdateData(
                table: "TimeTrials",
                keyColumn: "Id",
                keyValue: 2,
                columns: new[] { "EndDate", "StartDate" },
                values: new object[] { new DateTime(2026, 2, 25, 9, 51, 0, 392, DateTimeKind.Utc).AddTicks(5146), new DateTime(2026, 2, 18, 9, 51, 0, 392, DateTimeKind.Utc).AddTicks(5146) });
        }

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

            migrationBuilder.DropColumn(
                name: "CompressedSize",
                table: "GameAssets");

            migrationBuilder.DropColumn(
                name: "CustomAuthor",
                table: "GameAssets");

            migrationBuilder.DropColumn(
                name: "IsCustomContent",
                table: "GameAssets");

            migrationBuilder.DropColumn(
                name: "Md5Hash",
                table: "GameAssets");

            migrationBuilder.DropColumn(
                name: "CreatedAt",
                table: "Cars");

            migrationBuilder.DropColumn(
                name: "CustomAuthor",
                table: "Cars");

            migrationBuilder.DropColumn(
                name: "CustomVersion",
                table: "Cars");

            migrationBuilder.DropColumn(
                name: "Description",
                table: "Cars");

            migrationBuilder.DropColumn(
                name: "IsCustom",
                table: "Cars");

            migrationBuilder.DropColumn(
                name: "Year",
                table: "Cars");

            migrationBuilder.UpdateData(
                table: "TimeTrials",
                keyColumn: "Id",
                keyValue: 1,
                columns: new[] { "EndDate", "StartDate" },
                values: new object[] { new DateTime(2026, 2, 25, 9, 44, 15, 715, DateTimeKind.Utc).AddTicks(5651), new DateTime(2026, 2, 18, 9, 44, 15, 715, DateTimeKind.Utc).AddTicks(5648) });

            migrationBuilder.UpdateData(
                table: "TimeTrials",
                keyColumn: "Id",
                keyValue: 2,
                columns: new[] { "EndDate", "StartDate" },
                values: new object[] { new DateTime(2026, 2, 25, 9, 44, 15, 715, DateTimeKind.Utc).AddTicks(5658), new DateTime(2026, 2, 18, 9, 44, 15, 715, DateTimeKind.Utc).AddTicks(5658) });
        }
    }
}
