using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace PowderCoating.Infrastructure.Migrations
{
    /// <inheritdoc />
    public partial class AddCompanyOperatingCosts : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "CompanyOperatingCosts",
                columns: table => new
                {
                    Id = table.Column<int>(type: "int", nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    CompanyId = table.Column<int>(type: "int", nullable: false),
                    StandardLaborRate = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    OvertimeLaborRate = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    SpecializedLaborRate = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    ElectricityRatePerKwh = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    GasRatePerUnit = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    WaterRatePerUnit = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    OvenOperatingCostPerHour = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    SandblasterCostPerHour = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    CoatingBoothCostPerHour = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    GeneralMarkupPercentage = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    AdminOverheadPercentage = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    FacilityCostPercentage = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
                    CreatedAt = table.Column<DateTime>(type: "datetime2", nullable: false),
                    UpdatedAt = table.Column<DateTime>(type: "datetime2", nullable: true),
                    CreatedBy = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    UpdatedBy = table.Column<string>(type: "nvarchar(max)", nullable: true),
                    IsDeleted = table.Column<bool>(type: "bit", nullable: false),
                    DeletedAt = table.Column<DateTime>(type: "datetime2", nullable: true),
                    DeletedBy = table.Column<string>(type: "nvarchar(max)", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_CompanyOperatingCosts", x => x.Id);
                    table.ForeignKey(
                        name: "FK_CompanyOperatingCosts_Companies_CompanyId",
                        column: x => x.CompanyId,
                        principalTable: "Companies",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                });

            migrationBuilder.UpdateData(
                table: "PricingTiers",
                keyColumn: "Id",
                keyValue: 1,
                column: "CreatedAt",
                value: new DateTime(2026, 2, 6, 17, 43, 30, 41, DateTimeKind.Utc).AddTicks(5021));

            migrationBuilder.UpdateData(
                table: "PricingTiers",
                keyColumn: "Id",
                keyValue: 2,
                column: "CreatedAt",
                value: new DateTime(2026, 2, 6, 17, 43, 30, 41, DateTimeKind.Utc).AddTicks(5026));

            migrationBuilder.UpdateData(
                table: "PricingTiers",
                keyColumn: "Id",
                keyValue: 3,
                column: "CreatedAt",
                value: new DateTime(2026, 2, 6, 17, 43, 30, 41, DateTimeKind.Utc).AddTicks(5028));

            migrationBuilder.CreateIndex(
                name: "IX_CompanyOperatingCosts_CompanyId",
                table: "CompanyOperatingCosts",
                column: "CompanyId",
                unique: true);
        }

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

            migrationBuilder.UpdateData(
                table: "PricingTiers",
                keyColumn: "Id",
                keyValue: 1,
                column: "CreatedAt",
                value: new DateTime(2026, 2, 6, 15, 0, 38, 815, DateTimeKind.Utc).AddTicks(1700));

            migrationBuilder.UpdateData(
                table: "PricingTiers",
                keyColumn: "Id",
                keyValue: 2,
                column: "CreatedAt",
                value: new DateTime(2026, 2, 6, 15, 0, 38, 815, DateTimeKind.Utc).AddTicks(1704));

            migrationBuilder.UpdateData(
                table: "PricingTiers",
                keyColumn: "Id",
                keyValue: 3,
                column: "CreatedAt",
                value: new DateTime(2026, 2, 6, 15, 0, 38, 815, DateTimeKind.Utc).AddTicks(1706));
        }
    }
}
