using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Backend.Migrations
{
    /// <inheritdoc />
    public partial class AddNominationReviewWorkflow : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropIndex(
                name: "IX_Nominations_SeasonId",
                table: "Nominations");

            migrationBuilder.AddColumn<string>(
                name: "ReviewNote",
                table: "Nominations",
                type: "character varying(500)",
                maxLength: 500,
                nullable: true);

            migrationBuilder.AddColumn<DateTimeOffset>(
                name: "ReviewedAt",
                table: "Nominations",
                type: "timestamp with time zone",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "ReviewedByTwitchId",
                table: "Nominations",
                type: "character varying(120)",
                maxLength: 120,
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "Status",
                table: "Nominations",
                type: "character varying(20)",
                maxLength: 20,
                nullable: false,
                defaultValue: "");

            migrationBuilder.UpdateData(
                table: "Nominations",
                keyColumn: "Id",
                keyValue: 1,
                columns: new[] { "ReviewNote", "ReviewedAt", "ReviewedByTwitchId", "Status" },
                values: new object[] { null, null, null, "pending" });

            migrationBuilder.UpdateData(
                table: "Nominations",
                keyColumn: "Id",
                keyValue: 2,
                columns: new[] { "ReviewNote", "ReviewedAt", "ReviewedByTwitchId", "Status" },
                values: new object[] { null, null, null, "pending" });

            migrationBuilder.CreateIndex(
                name: "IX_Nominations_SeasonId_Status",
                table: "Nominations",
                columns: new[] { "SeasonId", "Status" });
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropIndex(
                name: "IX_Nominations_SeasonId_Status",
                table: "Nominations");

            migrationBuilder.DropColumn(
                name: "ReviewNote",
                table: "Nominations");

            migrationBuilder.DropColumn(
                name: "ReviewedAt",
                table: "Nominations");

            migrationBuilder.DropColumn(
                name: "ReviewedByTwitchId",
                table: "Nominations");

            migrationBuilder.DropColumn(
                name: "Status",
                table: "Nominations");

            migrationBuilder.CreateIndex(
                name: "IX_Nominations_SeasonId",
                table: "Nominations",
                column: "SeasonId");
        }
    }
}
