using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional

namespace Common.Migrations
{
    /// <inheritdoc />
    public partial class Orders : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<int>(
                name: "OrderId",
                table: "Products",
                type: "INTEGER",
                nullable: true);

            migrationBuilder.CreateTable(
                name: "Orders",
                columns: table => new
                {
                    ID = table.Column<int>(type: "INTEGER", nullable: false)
                        .Annotation("Sqlite:Autoincrement", true),
                    OrderDate = table.Column<DateTime>(type: "TEXT", nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Orders", x => x.ID);
                });

            migrationBuilder.InsertData(
                table: "Orders",
                columns: new[] { "ID", "OrderDate" },
                values: new object[,]
                {
                    { 1, new DateTime(2026, 3, 17, 0, 0, 0, 0, DateTimeKind.Unspecified) },
                    { 2, new DateTime(2026, 3, 17, 0, 0, 0, 0, DateTimeKind.Unspecified) },
                    { 3, new DateTime(2026, 3, 17, 0, 0, 0, 0, DateTimeKind.Unspecified) },
                    { 4, new DateTime(2026, 3, 17, 0, 0, 0, 0, DateTimeKind.Unspecified) },
                    { 5, new DateTime(2026, 3, 17, 0, 0, 0, 0, DateTimeKind.Unspecified) },
                    { 6, new DateTime(2026, 3, 17, 0, 0, 0, 0, DateTimeKind.Unspecified) },
                    { 7, new DateTime(2026, 3, 17, 0, 0, 0, 0, DateTimeKind.Unspecified) },
                    { 8, new DateTime(2026, 3, 17, 0, 0, 0, 0, DateTimeKind.Unspecified) },
                    { 9, new DateTime(2026, 3, 17, 0, 0, 0, 0, DateTimeKind.Unspecified) }
                });

            migrationBuilder.InsertData(
                table: "Products",
                columns: new[] { "ID", "Description", "ExpirationDate", "Image", "Name", "OrderId", "PackagingDate", "Price" },
                values: new object[,]
                {
                    { 1, "Heavy-duty rope suitable for boating, camping, and general use.", new DateTime(2026, 4, 13, 0, 0, 0, 0, DateTimeKind.Unspecified), null, "Multi-Purpose Marine Rope", 2, new DateTime(2025, 1, 15, 0, 0, 0, 0, DateTimeKind.Unspecified), 19.99f },
                    { 2, "Adjustable stand to improve ergonomics while working on a laptop.", new DateTime(2026, 6, 7, 0, 0, 0, 0, DateTimeKind.Unspecified), null, "Workstation Laptop Stand", 3, new DateTime(2025, 4, 24, 0, 0, 0, 0, DateTimeKind.Unspecified), 49.99f },
                    { 3, "Pasta tossed with fresh basil pesto, simple and delicious.", new DateTime(2026, 4, 3, 0, 0, 0, 0, DateTimeKind.Unspecified), null, "Basil Pesto Pasta", 1, new DateTime(2026, 1, 10, 0, 0, 0, 0, DateTimeKind.Unspecified), 6.49f },
                    { 4, "Quick oatmeal packets infused with apple and cinnamon, perfect for breakfast.", new DateTime(2026, 1, 22, 0, 0, 0, 0, DateTimeKind.Unspecified), null, "Apple Cinnamon Instant Oatmeal", 2, new DateTime(2025, 10, 28, 0, 0, 0, 0, DateTimeKind.Unspecified), 3.49f },
                    { 5, "Stylish bookends to keep books organized on shelves.", new DateTime(2026, 5, 27, 0, 0, 0, 0, DateTimeKind.Unspecified), null, "Sturdy Bookends", 2, new DateTime(2025, 9, 27, 0, 0, 0, 0, DateTimeKind.Unspecified), 22.99f },
                    { 6, "Spacious duffle bag for weekend getaways.", new DateTime(2026, 3, 28, 0, 0, 0, 0, DateTimeKind.Unspecified), null, "Overnight Duffle Bag", 1, new DateTime(2025, 3, 28, 0, 0, 0, 0, DateTimeKind.Unspecified), 34.99f },
                    { 7, "Chewy cookies made with coconut, perfect for sweet cravings.", new DateTime(2026, 6, 3, 0, 0, 0, 0, DateTimeKind.Unspecified), null, "Coconut Macaroons", 4, new DateTime(2025, 10, 13, 0, 0, 0, 0, DateTimeKind.Unspecified), 4.99f },
                    { 8, "Make delicious ice cream at home with this user-friendly machine.", new DateTime(2026, 3, 18, 0, 0, 0, 0, DateTimeKind.Unspecified), null, "Electric Ice Cream Maker", 4, new DateTime(2025, 1, 15, 0, 0, 0, 0, DateTimeKind.Unspecified), 59.99f },
                    { 9, "Eco-friendly silicone bags for food storage and snacks.", new DateTime(2026, 10, 8, 0, 0, 0, 0, DateTimeKind.Unspecified), null, "Reusable Food Storage Bags", 4, new DateTime(2025, 3, 9, 0, 0, 0, 0, DateTimeKind.Unspecified), 19.99f },
                    { 10, "Delicious cookies packed with oats and raisins.", new DateTime(2026, 8, 17, 0, 0, 0, 0, DateTimeKind.Unspecified), null, "Oatmeal Raisin Cookies", 4, new DateTime(2025, 2, 11, 0, 0, 0, 0, DateTimeKind.Unspecified), 3.49f }
                });

            migrationBuilder.CreateIndex(
                name: "IX_Products_OrderId",
                table: "Products",
                column: "OrderId");

            migrationBuilder.AddForeignKey(
                name: "FK_Products_Orders_OrderId",
                table: "Products",
                column: "OrderId",
                principalTable: "Orders",
                principalColumn: "ID");
        }

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

            migrationBuilder.DropTable(
                name: "Orders");

            migrationBuilder.DropIndex(
                name: "IX_Products_OrderId",
                table: "Products");

            migrationBuilder.DeleteData(
                table: "Products",
                keyColumn: "ID",
                keyValue: 1);

            migrationBuilder.DeleteData(
                table: "Products",
                keyColumn: "ID",
                keyValue: 2);

            migrationBuilder.DeleteData(
                table: "Products",
                keyColumn: "ID",
                keyValue: 3);

            migrationBuilder.DeleteData(
                table: "Products",
                keyColumn: "ID",
                keyValue: 4);

            migrationBuilder.DeleteData(
                table: "Products",
                keyColumn: "ID",
                keyValue: 5);

            migrationBuilder.DeleteData(
                table: "Products",
                keyColumn: "ID",
                keyValue: 6);

            migrationBuilder.DeleteData(
                table: "Products",
                keyColumn: "ID",
                keyValue: 7);

            migrationBuilder.DeleteData(
                table: "Products",
                keyColumn: "ID",
                keyValue: 8);

            migrationBuilder.DeleteData(
                table: "Products",
                keyColumn: "ID",
                keyValue: 9);

            migrationBuilder.DeleteData(
                table: "Products",
                keyColumn: "ID",
                keyValue: 10);

            migrationBuilder.DropColumn(
                name: "OrderId",
                table: "Products");
        }
    }
}
