using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

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

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

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

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

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

            migrationBuilder.UpdateData(
                table: "PricingTiers",
                keyColumn: "Id",
                keyValue: 1,
                column: "CreatedAt",
                value: new DateTime(2026, 2, 19, 14, 11, 2, 780, DateTimeKind.Utc).AddTicks(3625));

            migrationBuilder.UpdateData(
                table: "PricingTiers",
                keyColumn: "Id",
                keyValue: 2,
                column: "CreatedAt",
                value: new DateTime(2026, 2, 19, 14, 11, 2, 780, DateTimeKind.Utc).AddTicks(3630));

            migrationBuilder.UpdateData(
                table: "PricingTiers",
                keyColumn: "Id",
                keyValue: 3,
                column: "CreatedAt",
                value: new DateTime(2026, 2, 19, 14, 11, 2, 780, DateTimeKind.Utc).AddTicks(3632));

            migrationBuilder.CreateIndex(
                name: "IX_MaintenanceRecords_RecurrenceParentId",
                table: "MaintenanceRecords",
                column: "RecurrenceParentId");

            migrationBuilder.AddForeignKey(
                name: "FK_MaintenanceRecords_MaintenanceRecords_RecurrenceParentId",
                table: "MaintenanceRecords",
                column: "RecurrenceParentId",
                principalTable: "MaintenanceRecords",
                principalColumn: "Id");
        }

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

            migrationBuilder.DropIndex(
                name: "IX_MaintenanceRecords_RecurrenceParentId",
                table: "MaintenanceRecords");

            migrationBuilder.DropColumn(
                name: "IsRecurring",
                table: "MaintenanceRecords");

            migrationBuilder.DropColumn(
                name: "RecurrenceEndDate",
                table: "MaintenanceRecords");

            migrationBuilder.DropColumn(
                name: "RecurrenceFrequency",
                table: "MaintenanceRecords");

            migrationBuilder.DropColumn(
                name: "RecurrenceGroupId",
                table: "MaintenanceRecords");

            migrationBuilder.DropColumn(
                name: "RecurrenceParentId",
                table: "MaintenanceRecords");

            migrationBuilder.UpdateData(
                table: "PricingTiers",
                keyColumn: "Id",
                keyValue: 1,
                column: "CreatedAt",
                value: new DateTime(2026, 2, 18, 2, 34, 9, 378, DateTimeKind.Utc).AddTicks(8277));

            migrationBuilder.UpdateData(
                table: "PricingTiers",
                keyColumn: "Id",
                keyValue: 2,
                column: "CreatedAt",
                value: new DateTime(2026, 2, 18, 2, 34, 9, 378, DateTimeKind.Utc).AddTicks(8282));

            migrationBuilder.UpdateData(
                table: "PricingTiers",
                keyColumn: "Id",
                keyValue: 3,
                column: "CreatedAt",
                value: new DateTime(2026, 2, 18, 2, 34, 9, 378, DateTimeKind.Utc).AddTicks(8284));
        }
    }
}
