using Extrudex.Domain.Entities;

namespace Extrudex.Infrastructure.Data;

/// <summary>
/// Static seed data for all material lookup tables.
/// These are inserted via EF Core HasData during the initial migration.
/// 
/// IDs are deterministic GUIDs to ensure idempotent seed operations.
/// MaterialFinish is REQUIRED on every spool — default value is "Basic" (not "Standard").
/// </summary>
public static class SeedData
{
    // ─────────────────────────────────────────────
    // MaterialBase — deterministic GUIDs
    // ─────────────────────────────────────────────
    public static readonly Guid PlaId   = Guid.Parse("10000000-0000-0000-0000-000000000001");
    public static readonly Guid PetgId  = Guid.Parse("10000000-0000-0000-0000-000000000002");
    public static readonly Guid AbsId   = Guid.Parse("10000000-0000-0000-0000-000000000003");
    public static readonly Guid AsaId   = Guid.Parse("10000000-0000-0000-0000-000000000004");
    public static readonly Guid TpuId   = Guid.Parse("10000000-0000-0000-0000-000000000005");
    public static readonly Guid NylonId = Guid.Parse("10000000-0000-0000-0000-000000000006");

    public static readonly MaterialBase[] MaterialBases =
    [
        new() { Id = PlaId,   Name = "PLA",   DensityGperCm3 = 1.24m },
        new() { Id = PetgId,  Name = "PETG",  DensityGperCm3 = 1.27m },
        new() { Id = AbsId,   Name = "ABS",   DensityGperCm3 = 1.04m },
        new() { Id = AsaId,   Name = "ASA",   DensityGperCm3 = 1.07m },
        new() { Id = TpuId,   Name = "TPU",   DensityGperCm3 = 1.21m },
        new() { Id = NylonId, Name = "Nylon", DensityGperCm3 = 1.14m }
    ];

    // ─────────────────────────────────────────────
    // MaterialFinish — "Basic" is the default, NOT "Standard"
    // ─────────────────────────────────────────────
    public static readonly Guid PlaBasicId   = Guid.Parse("20000000-0000-0000-0000-000000000001");
    public static readonly Guid PlaMatteId   = Guid.Parse("20000000-0000-0000-0000-000000000002");
    public static readonly Guid PlaSilkId    = Guid.Parse("20000000-0000-0000-0000-000000000003");
    public static readonly Guid PlaGlitterId = Guid.Parse("20000000-0000-0000-0000-000000000004");
    public static readonly Guid PlaMarbleId  = Guid.Parse("20000000-0000-0000-0000-000000000005");
    public static readonly Guid PlaSparkleId = Guid.Parse("20000000-0000-0000-0000-000000000006");
    public static readonly Guid PetgBasicId  = Guid.Parse("20000000-0000-0000-0000-000000000007");
    public static readonly Guid PetgMatteId  = Guid.Parse("20000000-0000-0000-0000-000000000008");
    public static readonly Guid PetgSilkId   = Guid.Parse("20000000-0000-0000-0000-000000000009");
    public static readonly Guid AbsBasicId   = Guid.Parse("20000000-0000-0000-0000-000000000010");
    public static readonly Guid AbsMatteId   = Guid.Parse("20000000-0000-0000-0000-000000000011");
    public static readonly Guid AsaBasicId    = Guid.Parse("20000000-0000-0000-0000-000000000012");
    public static readonly Guid AsaMatteId    = Guid.Parse("20000000-0000-0000-0000-000000000013");
    public static readonly Guid TpuBasicId    = Guid.Parse("20000000-0000-0000-0000-000000000014");
    public static readonly Guid NylonBasicId  = Guid.Parse("20000000-0000-0000-0000-000000000015");

    public static readonly MaterialFinish[] MaterialFinishes =
    [
        // PLA finishes
        new() { Id = PlaBasicId,   Name = "Basic",   MaterialBaseId = PlaId },
        new() { Id = PlaMatteId,   Name = "Matte",   MaterialBaseId = PlaId },
        new() { Id = PlaSilkId,    Name = "Silk",    MaterialBaseId = PlaId },
        new() { Id = PlaGlitterId, Name = "Glitter", MaterialBaseId = PlaId },
        new() { Id = PlaMarbleId,  Name = "Marble",  MaterialBaseId = PlaId },
        new() { Id = PlaSparkleId, Name = "Sparkle", MaterialBaseId = PlaId },

        // PETG finishes
        new() { Id = PetgBasicId,  Name = "Basic",  MaterialBaseId = PetgId },
        new() { Id = PetgMatteId,  Name = "Matte",  MaterialBaseId = PetgId },
        new() { Id = PetgSilkId,   Name = "Silk",   MaterialBaseId = PetgId },

        // ABS finishes
        new() { Id = AbsBasicId,   Name = "Basic",   MaterialBaseId = AbsId },
        new() { Id = AbsMatteId,   Name = "Matte",   MaterialBaseId = AbsId },

        // ASA finishes
        new() { Id = AsaBasicId,   Name = "Basic",   MaterialBaseId = AsaId },
        new() { Id = AsaMatteId,   Name = "Matte",   MaterialBaseId = AsaId },

        // TPU finishes
        new() { Id = TpuBasicId,   Name = "Basic",   MaterialBaseId = TpuId },

        // Nylon finishes
        new() { Id = NylonBasicId,  Name = "Basic",  MaterialBaseId = NylonId }
    ];

    // ─────────────────────────────────────────────
    // MaterialModifier — optional additives
    // ─────────────────────────────────────────────
    public static readonly Guid PlaCarbonFiberId    = Guid.Parse("30000000-0000-0000-0000-000000000001");
    public static readonly Guid PlaGlassFiberId     = Guid.Parse("30000000-0000-0000-0000-000000000002");
    public static readonly Guid PlaWoodFillId      = Guid.Parse("30000000-0000-0000-0000-000000000003");
    public static readonly Guid PlaGlowInDarkId    = Guid.Parse("30000000-0000-0000-0000-000000000004");
    public static readonly Guid PetgCarbonFiberId   = Guid.Parse("30000000-0000-0000-0000-000000000005");
    public static readonly Guid PetgGlassFiberId    = Guid.Parse("30000000-0000-0000-0000-000000000006");
    public static readonly Guid AbsCarbonFiberId    = Guid.Parse("30000000-0000-0000-0000-000000000007");
    public static readonly Guid AbsGlassFiberId     = Guid.Parse("30000000-0000-0000-0000-000000000008");
    public static readonly Guid AsaCarbonFiberId     = Guid.Parse("30000000-0000-0000-0000-000000000009");
    public static readonly Guid NylonCarbonFiberId  = Guid.Parse("30000000-0000-0000-0000-000000000010");
    public static readonly Guid NylonGlassFiberId   = Guid.Parse("30000000-0000-0000-0000-000000000011");

    public static readonly MaterialModifier[] MaterialModifiers =
    [
        // PLA modifiers
        new() { Id = PlaCarbonFiberId,  Name = "Carbon Fiber",  MaterialBaseId = PlaId },
        new() { Id = PlaGlassFiberId,   Name = "Glass Fiber",   MaterialBaseId = PlaId },
        new() { Id = PlaWoodFillId,     Name = "Wood Fill",     MaterialBaseId = PlaId },
        new() { Id = PlaGlowInDarkId,   Name = "Glow-in-the-Dark", MaterialBaseId = PlaId },

        // PETG modifiers
        new() { Id = PetgCarbonFiberId,  Name = "Carbon Fiber",  MaterialBaseId = PetgId },
        new() { Id = PetgGlassFiberId,   Name = "Glass Fiber",   MaterialBaseId = PetgId },

        // ABS modifiers
        new() { Id = AbsCarbonFiberId,   Name = "Carbon Fiber",  MaterialBaseId = AbsId },
        new() { Id = AbsGlassFiberId,    Name = "Glass Fiber",   MaterialBaseId = AbsId },

        // ASA modifiers
        new() { Id = AsaCarbonFiberId,   Name = "Carbon Fiber",  MaterialBaseId = AsaId },

        // Nylon modifiers
        new() { Id = NylonCarbonFiberId, Name = "Carbon Fiber",  MaterialBaseId = NylonId },
        new() { Id = NylonGlassFiberId,  Name = "Glass Fiber",   MaterialBaseId = NylonId }
    ];
}