using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

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

            migrationBuilder.AddColumn<decimal>(
                name: "DepositPercent",
                table: "Quotes",
                type: "decimal(18,2)",
                nullable: false,
                defaultValue: 0m);

            migrationBuilder.AddColumn<bool>(
                name: "RequiresDeposit",
                table: "Quotes",
                type: "bit",
                nullable: false,
                defaultValue: false);

            migrationBuilder.AddColumn<decimal>(
                name: "OnlineAmountPaid",
                table: "Invoices",
                type: "decimal(18,2)",
                nullable: false,
                defaultValue: 0m);

            migrationBuilder.AddColumn<int>(
                name: "OnlinePaymentStatus",
                table: "Invoices",
                type: "int",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.AddColumn<decimal>(
                name: "OnlineSurchargeCollected",
                table: "Invoices",
                type: "decimal(18,2)",
                nullable: false,
                defaultValue: 0m);

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

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

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

            migrationBuilder.AddColumn<int>(
                name: "OnlinePaymentSurchargeType",
                table: "Companies",
                type: "int",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.AddColumn<decimal>(
                name: "OnlinePaymentSurchargeValue",
                table: "Companies",
                type: "decimal(18,2)",
                nullable: false,
                defaultValue: 0m);

            migrationBuilder.AddColumn<bool>(
                name: "OnlineSurchargeAcknowledged",
                table: "Companies",
                type: "bit",
                nullable: false,
                defaultValue: false);

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

            migrationBuilder.AddColumn<int>(
                name: "StripeConnectStatus",
                table: "Companies",
                type: "int",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.UpdateData(
                table: "PricingTiers",
                keyColumn: "Id",
                keyValue: 1,
                column: "CreatedAt",
                value: new DateTime(2026, 3, 20, 23, 15, 5, 688, DateTimeKind.Utc).AddTicks(6302));

            migrationBuilder.UpdateData(
                table: "PricingTiers",
                keyColumn: "Id",
                keyValue: 2,
                column: "CreatedAt",
                value: new DateTime(2026, 3, 20, 23, 15, 5, 688, DateTimeKind.Utc).AddTicks(6308));

            migrationBuilder.UpdateData(
                table: "PricingTiers",
                keyColumn: "Id",
                keyValue: 3,
                column: "CreatedAt",
                value: new DateTime(2026, 3, 20, 23, 15, 5, 688, DateTimeKind.Utc).AddTicks(6310));
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropColumn(
                name: "AllowOnlinePayments",
                table: "SubscriptionPlanConfigs");

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

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

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

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

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

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

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

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

            migrationBuilder.DropColumn(
                name: "OnlinePaymentSurchargeType",
                table: "Companies");

            migrationBuilder.DropColumn(
                name: "OnlinePaymentSurchargeValue",
                table: "Companies");

            migrationBuilder.DropColumn(
                name: "OnlineSurchargeAcknowledged",
                table: "Companies");

            migrationBuilder.DropColumn(
                name: "StripeAccountId",
                table: "Companies");

            migrationBuilder.DropColumn(
                name: "StripeConnectStatus",
                table: "Companies");

            migrationBuilder.UpdateData(
                table: "PricingTiers",
                keyColumn: "Id",
                keyValue: 1,
                column: "CreatedAt",
                value: new DateTime(2026, 3, 20, 1, 10, 54, 146, DateTimeKind.Utc).AddTicks(8159));

            migrationBuilder.UpdateData(
                table: "PricingTiers",
                keyColumn: "Id",
                keyValue: 2,
                column: "CreatedAt",
                value: new DateTime(2026, 3, 20, 1, 10, 54, 146, DateTimeKind.Utc).AddTicks(8166));

            migrationBuilder.UpdateData(
                table: "PricingTiers",
                keyColumn: "Id",
                keyValue: 3,
                column: "CreatedAt",
                value: new DateTime(2026, 3, 20, 1, 10, 54, 146, DateTimeKind.Utc).AddTicks(8176));
        }
    }
}
