using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

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

namespace BookHive.Migrations
{
    /// <inheritdoc />
    public partial class AddedData : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.InsertData(
                table: "Authors",
                columns: new[] { "Id", "Biography", "BirthDate", "FirstName", "LastName", "Nationality" },
                values: new object[,]
                {
                    { 1, "Auteur britannique connu pour ses romans dystopiques.", new DateOnly(1903, 6, 25), "George", "Orwell", "Britannique" },
                    { 2, "Romancière anglaise célèbre pour ses romans sur la société.", new DateOnly(1775, 12, 16), "Jane", "Austen", "Britannique" },
                    { 3, "Poète et écrivain français du XIXe siècle.", new DateOnly(1802, 2, 26), "Victor", "Hugo", "Française" }
                });

            migrationBuilder.InsertData(
                table: "Members",
                columns: new[] { "Id", "Email", "FirstName", "IsActive", "LastName", "MembershipDate" },
                values: new object[,]
                {
                    { 1, "alice@example.com", "Alice", true, "Martin", new DateOnly(2023, 1, 10) },
                    { 2, "bob@example.com", "Bob", true, "Durand", new DateOnly(2023, 5, 12) },
                    { 3, "claire@example.com", "Claire", true, "Petit", new DateOnly(2024, 2, 2) },
                    { 4, "david@example.com", "David", true, "Bernard", new DateOnly(2024, 6, 15) }
                });

            migrationBuilder.InsertData(
                table: "Books",
                columns: new[] { "Id", "AuthorId", "Genre", "Isbn", "PageCount", "PublishedDate", "Summary", "Title" },
                values: new object[,]
                {
                    { 1, 1, "Dystopie", "9780451524935", 328, new DateOnly(1949, 6, 8), "Roman dystopique sur un régime totalitaire.", "1984" },
                    { 2, 1, "Satire", "9780451526342", 112, new DateOnly(1945, 8, 17), "Satire politique sous forme de fable animale.", "Animal Farm" },
                    { 3, 2, "Roman", "9780141439518", 279, new DateOnly(1813, 1, 28), "Histoire romantique dans l'Angleterre du XIXe siècle.", "Pride and Prejudice" },
                    { 4, 2, "Roman", "9780141439662", 226, new DateOnly(1811, 10, 30), "Roman sur les sœurs Dashwood.", "Sense and Sensibility" },
                    { 5, 3, "Roman historique", "9782070409189", 1463, new DateOnly(1862, 4, 3), "Grande fresque sociale sur la misère et la justice.", "Les Misérables" },
                    { 6, 3, "Roman historique", "9782253004226", 940, new DateOnly(1831, 1, 14), "Roman historique se déroulant à Paris.", "Notre-Dame de Paris" }
                });

            migrationBuilder.InsertData(
                table: "Loans",
                columns: new[] { "Id", "BookId", "DueDate", "LoanDate", "MemberId", "ReturnDate" },
                values: new object[,]
                {
                    { 1, 1, new DateOnly(2025, 12, 15), new DateOnly(2025, 12, 1), 1, new DateOnly(2025, 12, 10) },
                    { 2, 2, new DateOnly(2025, 12, 20), new DateOnly(2025, 12, 5), 2, new DateOnly(2025, 12, 18) },
                    { 3, 3, new DateOnly(2025, 12, 25), new DateOnly(2025, 12, 10), 3, null },
                    { 4, 4, new DateOnly(2025, 12, 27), new DateOnly(2025, 12, 12), 1, null },
                    { 5, 5, new DateOnly(2025, 11, 15), new DateOnly(2025, 11, 1), 2, new DateOnly(2025, 11, 14) }
                });

            migrationBuilder.InsertData(
                table: "Reviews",
                columns: new[] { "Id", "BookId", "Comment", "CreatedAt", "MemberId", "Rating" },
                values: new object[,]
                {
                    { 1, 1, "Un chef-d'œuvre dystopique.", new DateTime(2025, 12, 1, 0, 0, 0, 0, DateTimeKind.Unspecified), 1, 5 },
                    { 2, 3, "Très bon roman classique.", new DateTime(2025, 12, 2, 0, 0, 0, 0, DateTimeKind.Unspecified), 2, 4 },
                    { 3, 5, "Incroyable roman historique.", new DateTime(2025, 12, 3, 0, 0, 0, 0, DateTimeKind.Unspecified), 3, 5 },
                    { 4, 2, "Drôle et intelligent.", new DateTime(2025, 12, 4, 0, 0, 0, 0, DateTimeKind.Unspecified), 4, 4 }
                });
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DeleteData(
                table: "Books",
                keyColumn: "Id",
                keyValue: 6);

            migrationBuilder.DeleteData(
                table: "Loans",
                keyColumn: "Id",
                keyValue: 1);

            migrationBuilder.DeleteData(
                table: "Loans",
                keyColumn: "Id",
                keyValue: 2);

            migrationBuilder.DeleteData(
                table: "Loans",
                keyColumn: "Id",
                keyValue: 3);

            migrationBuilder.DeleteData(
                table: "Loans",
                keyColumn: "Id",
                keyValue: 4);

            migrationBuilder.DeleteData(
                table: "Loans",
                keyColumn: "Id",
                keyValue: 5);

            migrationBuilder.DeleteData(
                table: "Reviews",
                keyColumn: "Id",
                keyValue: 1);

            migrationBuilder.DeleteData(
                table: "Reviews",
                keyColumn: "Id",
                keyValue: 2);

            migrationBuilder.DeleteData(
                table: "Reviews",
                keyColumn: "Id",
                keyValue: 3);

            migrationBuilder.DeleteData(
                table: "Reviews",
                keyColumn: "Id",
                keyValue: 4);

            migrationBuilder.DeleteData(
                table: "Books",
                keyColumn: "Id",
                keyValue: 1);

            migrationBuilder.DeleteData(
                table: "Books",
                keyColumn: "Id",
                keyValue: 2);

            migrationBuilder.DeleteData(
                table: "Books",
                keyColumn: "Id",
                keyValue: 3);

            migrationBuilder.DeleteData(
                table: "Books",
                keyColumn: "Id",
                keyValue: 4);

            migrationBuilder.DeleteData(
                table: "Books",
                keyColumn: "Id",
                keyValue: 5);

            migrationBuilder.DeleteData(
                table: "Members",
                keyColumn: "Id",
                keyValue: 1);

            migrationBuilder.DeleteData(
                table: "Members",
                keyColumn: "Id",
                keyValue: 2);

            migrationBuilder.DeleteData(
                table: "Members",
                keyColumn: "Id",
                keyValue: 3);

            migrationBuilder.DeleteData(
                table: "Members",
                keyColumn: "Id",
                keyValue: 4);

            migrationBuilder.DeleteData(
                table: "Authors",
                keyColumn: "Id",
                keyValue: 1);

            migrationBuilder.DeleteData(
                table: "Authors",
                keyColumn: "Id",
                keyValue: 2);

            migrationBuilder.DeleteData(
                table: "Authors",
                keyColumn: "Id",
                keyValue: 3);
        }
    }
}
