using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace PowderCoating.Infrastructure.Migrations
{
    /// <inheritdoc />
    public partial class UpdateJobPhotoEntity : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.RenameColumn(
                name: "PhotoDate",
                table: "JobPhotos",
                newName: "UploadedDate");

            migrationBuilder.RenameColumn(
                name: "Description",
                table: "JobPhotos",
                newName: "Caption");

            migrationBuilder.AlterColumn<int>(
                name: "PhotoType",
                table: "JobPhotos",
                type: "int",
                nullable: false,
                oldClrType: typeof(string),
                oldType: "nvarchar(max)");

            migrationBuilder.AddColumn<string>(
                name: "ContentType",
                table: "JobPhotos",
                type: "nvarchar(max)",
                nullable: false,
                defaultValue: "");

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

            migrationBuilder.AddColumn<long>(
                name: "FileSize",
                table: "JobPhotos",
                type: "bigint",
                nullable: false,
                defaultValue: 0L);

            migrationBuilder.AddColumn<string>(
                name: "UploadedById",
                table: "JobPhotos",
                type: "nvarchar(450)",
                nullable: false,
                defaultValue: "");

            migrationBuilder.UpdateData(
                table: "PricingTiers",
                keyColumn: "Id",
                keyValue: 1,
                column: "CreatedAt",
                value: new DateTime(2026, 2, 11, 0, 54, 54, 262, DateTimeKind.Utc).AddTicks(9259));

            migrationBuilder.UpdateData(
                table: "PricingTiers",
                keyColumn: "Id",
                keyValue: 2,
                column: "CreatedAt",
                value: new DateTime(2026, 2, 11, 0, 54, 54, 262, DateTimeKind.Utc).AddTicks(9263));

            migrationBuilder.UpdateData(
                table: "PricingTiers",
                keyColumn: "Id",
                keyValue: 3,
                column: "CreatedAt",
                value: new DateTime(2026, 2, 11, 0, 54, 54, 262, DateTimeKind.Utc).AddTicks(9265));

            migrationBuilder.CreateIndex(
                name: "IX_JobPhotos_UploadedById",
                table: "JobPhotos",
                column: "UploadedById");

            migrationBuilder.AddForeignKey(
                name: "FK_JobPhotos_AspNetUsers_UploadedById",
                table: "JobPhotos",
                column: "UploadedById",
                principalTable: "AspNetUsers",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }

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

            migrationBuilder.DropIndex(
                name: "IX_JobPhotos_UploadedById",
                table: "JobPhotos");

            migrationBuilder.DropColumn(
                name: "ContentType",
                table: "JobPhotos");

            migrationBuilder.DropColumn(
                name: "DisplayOrder",
                table: "JobPhotos");

            migrationBuilder.DropColumn(
                name: "FileSize",
                table: "JobPhotos");

            migrationBuilder.DropColumn(
                name: "UploadedById",
                table: "JobPhotos");

            migrationBuilder.RenameColumn(
                name: "UploadedDate",
                table: "JobPhotos",
                newName: "PhotoDate");

            migrationBuilder.RenameColumn(
                name: "Caption",
                table: "JobPhotos",
                newName: "Description");

            migrationBuilder.AlterColumn<string>(
                name: "PhotoType",
                table: "JobPhotos",
                type: "nvarchar(max)",
                nullable: false,
                oldClrType: typeof(int),
                oldType: "int");

            migrationBuilder.UpdateData(
                table: "PricingTiers",
                keyColumn: "Id",
                keyValue: 1,
                column: "CreatedAt",
                value: new DateTime(2026, 2, 11, 0, 28, 19, 897, DateTimeKind.Utc).AddTicks(5461));

            migrationBuilder.UpdateData(
                table: "PricingTiers",
                keyColumn: "Id",
                keyValue: 2,
                column: "CreatedAt",
                value: new DateTime(2026, 2, 11, 0, 28, 19, 897, DateTimeKind.Utc).AddTicks(5466));

            migrationBuilder.UpdateData(
                table: "PricingTiers",
                keyColumn: "Id",
                keyValue: 3,
                column: "CreatedAt",
                value: new DateTime(2026, 2, 11, 0, 28, 19, 897, DateTimeKind.Utc).AddTicks(5469));
        }
    }
}
