using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace PowderCoating.Infrastructure.Migrations
{
    /// <inheritdoc />
    public partial class AddPaymentDepositAndInvoiceSalesTax : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<int>(
                name: "DepositAccountId",
                table: "Payments",
                type: "int",
                nullable: true);

            migrationBuilder.AddColumn<int>(
                name: "SalesTaxAccountId",
                table: "Invoices",
                type: "int",
                nullable: true);

            migrationBuilder.UpdateData(
                table: "PricingTiers",
                keyColumn: "Id",
                keyValue: 1,
                column: "CreatedAt",
                value: new DateTime(2026, 3, 8, 3, 45, 54, 406, DateTimeKind.Utc).AddTicks(8622));

            migrationBuilder.UpdateData(
                table: "PricingTiers",
                keyColumn: "Id",
                keyValue: 2,
                column: "CreatedAt",
                value: new DateTime(2026, 3, 8, 3, 45, 54, 406, DateTimeKind.Utc).AddTicks(8628));

            migrationBuilder.UpdateData(
                table: "PricingTiers",
                keyColumn: "Id",
                keyValue: 3,
                column: "CreatedAt",
                value: new DateTime(2026, 3, 8, 3, 45, 54, 406, DateTimeKind.Utc).AddTicks(8630));

            migrationBuilder.CreateIndex(
                name: "IX_Payments_DepositAccountId",
                table: "Payments",
                column: "DepositAccountId");

            migrationBuilder.CreateIndex(
                name: "IX_Invoices_SalesTaxAccountId",
                table: "Invoices",
                column: "SalesTaxAccountId");

            migrationBuilder.AddForeignKey(
                name: "FK_Invoices_Accounts_SalesTaxAccountId",
                table: "Invoices",
                column: "SalesTaxAccountId",
                principalTable: "Accounts",
                principalColumn: "Id");

            migrationBuilder.AddForeignKey(
                name: "FK_Payments_Accounts_DepositAccountId",
                table: "Payments",
                column: "DepositAccountId",
                principalTable: "Accounts",
                principalColumn: "Id");
        }

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

            migrationBuilder.DropForeignKey(
                name: "FK_Payments_Accounts_DepositAccountId",
                table: "Payments");

            migrationBuilder.DropIndex(
                name: "IX_Payments_DepositAccountId",
                table: "Payments");

            migrationBuilder.DropIndex(
                name: "IX_Invoices_SalesTaxAccountId",
                table: "Invoices");

            migrationBuilder.DropColumn(
                name: "DepositAccountId",
                table: "Payments");

            migrationBuilder.DropColumn(
                name: "SalesTaxAccountId",
                table: "Invoices");

            migrationBuilder.UpdateData(
                table: "PricingTiers",
                keyColumn: "Id",
                keyValue: 1,
                column: "CreatedAt",
                value: new DateTime(2026, 3, 8, 3, 39, 41, 974, DateTimeKind.Utc).AddTicks(5262));

            migrationBuilder.UpdateData(
                table: "PricingTiers",
                keyColumn: "Id",
                keyValue: 2,
                column: "CreatedAt",
                value: new DateTime(2026, 3, 8, 3, 39, 41, 974, DateTimeKind.Utc).AddTicks(5268));

            migrationBuilder.UpdateData(
                table: "PricingTiers",
                keyColumn: "Id",
                keyValue: 3,
                column: "CreatedAt",
                value: new DateTime(2026, 3, 8, 3, 39, 41, 974, DateTimeKind.Utc).AddTicks(5293));
        }
    }
}
