using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace PowderCoating.Infrastructure.Migrations
{
    /// <inheritdoc />
    public partial class AddQuoteApprovalToken : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<bool>(
                name: "IsRejectedStatus",
                table: "QuoteStatusLookups",
                type: "bit",
                nullable: false,
                defaultValue: false);

            migrationBuilder.AddColumn<string>(
                name: "ApprovalToken",
                table: "Quotes",
                type: "nvarchar(450)",
                nullable: true);

            migrationBuilder.AddColumn<DateTime>(
                name: "ApprovalTokenExpiresAt",
                table: "Quotes",
                type: "datetime2",
                nullable: true);

            migrationBuilder.AddColumn<DateTime>(
                name: "ApprovalTokenUsedAt",
                table: "Quotes",
                type: "datetime2",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "DeclineReason",
                table: "Quotes",
                type: "nvarchar(max)",
                nullable: true);

            migrationBuilder.AddColumn<string>(
                name: "DeclinedByIp",
                table: "Quotes",
                type: "nvarchar(max)",
                nullable: true);

            migrationBuilder.UpdateData(
                table: "PricingTiers",
                keyColumn: "Id",
                keyValue: 1,
                column: "CreatedAt",
                value: new DateTime(2026, 3, 9, 12, 51, 6, 767, DateTimeKind.Utc).AddTicks(3381));

            migrationBuilder.UpdateData(
                table: "PricingTiers",
                keyColumn: "Id",
                keyValue: 2,
                column: "CreatedAt",
                value: new DateTime(2026, 3, 9, 12, 51, 6, 767, DateTimeKind.Utc).AddTicks(3388));

            migrationBuilder.UpdateData(
                table: "PricingTiers",
                keyColumn: "Id",
                keyValue: 3,
                column: "CreatedAt",
                value: new DateTime(2026, 3, 9, 12, 51, 6, 767, DateTimeKind.Utc).AddTicks(3389));

            migrationBuilder.CreateIndex(
                name: "IX_Quotes_ApprovalToken",
                table: "Quotes",
                column: "ApprovalToken",
                unique: true,
                filter: "[ApprovalToken] IS NOT NULL");
        }

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

            migrationBuilder.DropColumn(
                name: "IsRejectedStatus",
                table: "QuoteStatusLookups");

            migrationBuilder.DropColumn(
                name: "ApprovalToken",
                table: "Quotes");

            migrationBuilder.DropColumn(
                name: "ApprovalTokenExpiresAt",
                table: "Quotes");

            migrationBuilder.DropColumn(
                name: "ApprovalTokenUsedAt",
                table: "Quotes");

            migrationBuilder.DropColumn(
                name: "DeclineReason",
                table: "Quotes");

            migrationBuilder.DropColumn(
                name: "DeclinedByIp",
                table: "Quotes");

            migrationBuilder.UpdateData(
                table: "PricingTiers",
                keyColumn: "Id",
                keyValue: 1,
                column: "CreatedAt",
                value: new DateTime(2026, 3, 8, 21, 25, 27, 588, DateTimeKind.Utc).AddTicks(3784));

            migrationBuilder.UpdateData(
                table: "PricingTiers",
                keyColumn: "Id",
                keyValue: 2,
                column: "CreatedAt",
                value: new DateTime(2026, 3, 8, 21, 25, 27, 588, DateTimeKind.Utc).AddTicks(3789));

            migrationBuilder.UpdateData(
                table: "PricingTiers",
                keyColumn: "Id",
                keyValue: 3,
                column: "CreatedAt",
                value: new DateTime(2026, 3, 8, 21, 25, 27, 588, DateTimeKind.Utc).AddTicks(3791));
        }
    }
}
