using Microsoft.EntityFrameworkCore;
using PowderCoating.Core.Entities;

namespace PowderCoating.Infrastructure.Services;

public partial class SeedDataService
{
    /// <summary>
    /// Seeds eight catalog categories and 60 pre-priced catalog items representing the
    /// most common powder coating service types: automotive wheels, engine components,
    /// outdoor furniture, railings, gates and fencing, fitness equipment, office/commercial
    /// fixtures, and shop merchandise (apparel and retail items).
    /// </summary>
    /// <remarks>
    /// <para>
    /// Idempotency: checks for the existence of the sentinel category "Automotive Wheels"
    /// (first category, always seeded) before inserting. Returns 0 if it already exists.
    /// </para>
    /// <para>
    /// SKUs are prefixed with the company code (e.g. <c>DEMO-WHL-18ALU</c>) so that catalog
    /// items from different tenants never collide and seeded items can be reliably identified
    /// for removal by the remove seeder.
    /// </para>
    /// <para>
    /// Shop Merchandise items (T-shirts, hats, stickers, gift cards) have
    /// <c>DefaultEstimatedMinutes = 0</c> and both sandblasting/masking flags set to false
    /// because they are retail items, not coating services. This is intentional and ensures
    /// the job-wizard does not add prep-service costs to merchandise line items.
    /// </para>
    /// <para>
    /// Categories and items are inserted in two separate <c>SaveChangesAsync</c> calls so that
    /// EF Core has assigned IDs to categories before they are referenced as foreign keys by items.
    /// </para>
    /// </remarks>
    /// <param name="company">The tenant company to seed catalog data for.</param>
    /// <returns>Number of catalog items inserted (categories are not counted), or 0 if already seeded.</returns>
    private async Task<int> SeedCatalogAsync(Company company)
    {
        // Check if seed catalog already exists by looking for specific category
        var seedCategoryExists = await _context.Set<CatalogCategory>()
            .IgnoreQueryFilters()
            .AnyAsync(c => c.CompanyId == company.Id && c.Name == "Automotive Wheels" && !c.IsDeleted);

        if (seedCategoryExists)
        {
            return 0; // Seed data already exists
        }

        // Create root categories
        var categories = new List<CatalogCategory>
        {
            new CatalogCategory
            {
                Name = "Automotive Wheels",
                Description = "Car, truck, and motorcycle wheels",
                DisplayOrder = 1,
                IsActive = true,
                CompanyId = company.Id,
                CreatedAt = DateTime.UtcNow
            },
            new CatalogCategory
            {
                Name = "Engine Components",
                Description = "Engine parts, covers, and accessories",
                DisplayOrder = 2,
                IsActive = true,
                CompanyId = company.Id,
                CreatedAt = DateTime.UtcNow
            },
            new CatalogCategory
            {
                Name = "Outdoor Furniture",
                Description = "Patio and garden furniture",
                DisplayOrder = 3,
                IsActive = true,
                CompanyId = company.Id,
                CreatedAt = DateTime.UtcNow
            },
            new CatalogCategory
            {
                Name = "Railings & Handrails",
                Description = "Residential and commercial railings",
                DisplayOrder = 4,
                IsActive = true,
                CompanyId = company.Id,
                CreatedAt = DateTime.UtcNow
            },
            new CatalogCategory
            {
                Name = "Gates & Fencing",
                Description = "Gates, fencing panels, and posts",
                DisplayOrder = 5,
                IsActive = true,
                CompanyId = company.Id,
                CreatedAt = DateTime.UtcNow
            },
            new CatalogCategory
            {
                Name = "Fitness Equipment",
                Description = "Gym and exercise equipment components",
                DisplayOrder = 6,
                IsActive = true,
                CompanyId = company.Id,
                CreatedAt = DateTime.UtcNow
            },
            new CatalogCategory
            {
                Name = "Office & Commercial",
                Description = "Office furniture and commercial fixtures",
                DisplayOrder = 7,
                IsActive = true,
                CompanyId = company.Id,
                CreatedAt = DateTime.UtcNow
            },
            new CatalogCategory
            {
                Name = "Shop Merchandise",
                Description = "Branded apparel, accessories, and shop retail items",
                DisplayOrder = 8,
                IsActive = true,
                CompanyId = company.Id,
                CreatedAt = DateTime.UtcNow
            }
        };

        await _context.Set<CatalogCategory>().AddRangeAsync(categories);
        await _context.SaveChangesAsync();

        // Create catalog items
        var items = new List<CatalogItem>
        {
            // Automotive Wheels (10 items)
            new CatalogItem { Name = "14\" Steel Wheel", SKU = $"{company.CompanyCode}-WHL-14STL", CategoryId = categories[0].Id, DefaultPrice = 45.00m, DefaultRequiresSandblasting = true, DefaultRequiresMasking = false, DefaultEstimatedMinutes = 25, DisplayOrder = 1, IsActive = true, CompanyId = company.Id, CreatedAt = DateTime.UtcNow },
            new CatalogItem { Name = "15\" Aluminum Alloy Wheel", SKU = $"{company.CompanyCode}-WHL-15ALU", CategoryId = categories[0].Id, DefaultPrice = 65.00m, DefaultRequiresSandblasting = true, DefaultRequiresMasking = false, DefaultEstimatedMinutes = 30, DisplayOrder = 2, IsActive = true, CompanyId = company.Id, CreatedAt = DateTime.UtcNow },
            new CatalogItem { Name = "16\" Aluminum Alloy Wheel", SKU = $"{company.CompanyCode}-WHL-16ALU", CategoryId = categories[0].Id, DefaultPrice = 70.00m, DefaultRequiresSandblasting = true, DefaultRequiresMasking = false, DefaultEstimatedMinutes = 30, DisplayOrder = 3, IsActive = true, CompanyId = company.Id, CreatedAt = DateTime.UtcNow },
            new CatalogItem { Name = "17\" Aluminum Alloy Wheel", SKU = $"{company.CompanyCode}-WHL-17ALU", CategoryId = categories[0].Id, DefaultPrice = 75.00m, DefaultRequiresSandblasting = true, DefaultRequiresMasking = false, DefaultEstimatedMinutes = 35, DisplayOrder = 4, IsActive = true, CompanyId = company.Id, CreatedAt = DateTime.UtcNow },
            new CatalogItem { Name = "18\" Aluminum Alloy Wheel", SKU = $"{company.CompanyCode}-WHL-18ALU", CategoryId = categories[0].Id, DefaultPrice = 80.00m, DefaultRequiresSandblasting = true, DefaultRequiresMasking = false, DefaultEstimatedMinutes = 35, DisplayOrder = 5, IsActive = true, CompanyId = company.Id, CreatedAt = DateTime.UtcNow },
            new CatalogItem { Name = "20\" Aluminum Alloy Wheel", SKU = $"{company.CompanyCode}-WHL-20ALU", CategoryId = categories[0].Id, DefaultPrice = 90.00m, DefaultRequiresSandblasting = true, DefaultRequiresMasking = false, DefaultEstimatedMinutes = 40, DisplayOrder = 6, IsActive = true, CompanyId = company.Id, CreatedAt = DateTime.UtcNow },
            new CatalogItem { Name = "22\" Truck Wheel", SKU = $"{company.CompanyCode}-WHL-22TRK", CategoryId = categories[0].Id, DefaultPrice = 110.00m, DefaultRequiresSandblasting = true, DefaultRequiresMasking = false, DefaultEstimatedMinutes = 45, DisplayOrder = 7, IsActive = true, CompanyId = company.Id, CreatedAt = DateTime.UtcNow },
            new CatalogItem { Name = "Chrome Wheel (Re-coating)", SKU = $"{company.CompanyCode}-WHL-CHR", CategoryId = categories[0].Id, DefaultPrice = 125.00m, DefaultRequiresSandblasting = true, DefaultRequiresMasking = true, DefaultEstimatedMinutes = 60, DisplayOrder = 8, IsActive = true, CompanyId = company.Id, CreatedAt = DateTime.UtcNow },
            new CatalogItem { Name = "Motorcycle Wheel", SKU = $"{company.CompanyCode}-WHL-MCYCLE", CategoryId = categories[0].Id, DefaultPrice = 55.00m, DefaultRequiresSandblasting = true, DefaultRequiresMasking = false, DefaultEstimatedMinutes = 30, DisplayOrder = 9, IsActive = true, CompanyId = company.Id, CreatedAt = DateTime.UtcNow },
            new CatalogItem { Name = "Custom/Specialty Wheel", SKU = $"{company.CompanyCode}-WHL-CUSTOM", CategoryId = categories[0].Id, DefaultPrice = 95.00m, DefaultRequiresSandblasting = true, DefaultRequiresMasking = true, DefaultEstimatedMinutes = 50, DisplayOrder = 10, IsActive = true, CompanyId = company.Id, CreatedAt = DateTime.UtcNow },

            // Engine Components (8 items)
            new CatalogItem { Name = "4-Cylinder Valve Cover", SKU = $"{company.CompanyCode}-ENG-VC4", CategoryId = categories[1].Id, DefaultPrice = 45.00m, DefaultRequiresSandblasting = true, DefaultRequiresMasking = true, DefaultEstimatedMinutes = 45, DisplayOrder = 1, IsActive = true, CompanyId = company.Id, CreatedAt = DateTime.UtcNow },
            new CatalogItem { Name = "6-Cylinder Valve Cover", SKU = $"{company.CompanyCode}-ENG-VC6", CategoryId = categories[1].Id, DefaultPrice = 55.00m, DefaultRequiresSandblasting = true, DefaultRequiresMasking = true, DefaultEstimatedMinutes = 60, DisplayOrder = 2, IsActive = true, CompanyId = company.Id, CreatedAt = DateTime.UtcNow },
            new CatalogItem { Name = "8-Cylinder Valve Cover (Pair)", SKU = $"{company.CompanyCode}-ENG-VC8", CategoryId = categories[1].Id, DefaultPrice = 85.00m, DefaultRequiresSandblasting = true, DefaultRequiresMasking = true, DefaultEstimatedMinutes = 90, DisplayOrder = 3, IsActive = true, CompanyId = company.Id, CreatedAt = DateTime.UtcNow },
            new CatalogItem { Name = "Intake Manifold", SKU = $"{company.CompanyCode}-ENG-IM", CategoryId = categories[1].Id, DefaultPrice = 65.00m, DefaultRequiresSandblasting = true, DefaultRequiresMasking = true, DefaultEstimatedMinutes = 75, DisplayOrder = 4, IsActive = true, CompanyId = company.Id, CreatedAt = DateTime.UtcNow },
            new CatalogItem { Name = "Oil Pan", SKU = $"{company.CompanyCode}-ENG-PAN", CategoryId = categories[1].Id, DefaultPrice = 40.00m, DefaultRequiresSandblasting = true, DefaultRequiresMasking = true, DefaultEstimatedMinutes = 40, DisplayOrder = 5, IsActive = true, CompanyId = company.Id, CreatedAt = DateTime.UtcNow },
            new CatalogItem { Name = "Timing Cover", SKU = $"{company.CompanyCode}-ENG-TC", CategoryId = categories[1].Id, DefaultPrice = 38.00m, DefaultRequiresSandblasting = true, DefaultRequiresMasking = true, DefaultEstimatedMinutes = 35, DisplayOrder = 6, IsActive = true, CompanyId = company.Id, CreatedAt = DateTime.UtcNow },
            new CatalogItem { Name = "Air Cleaner Housing", SKU = $"{company.CompanyCode}-ENG-AC", CategoryId = categories[1].Id, DefaultPrice = 35.00m, DefaultRequiresSandblasting = true, DefaultRequiresMasking = false, DefaultEstimatedMinutes = 30, DisplayOrder = 7, IsActive = true, CompanyId = company.Id, CreatedAt = DateTime.UtcNow },
            new CatalogItem { Name = "Transmission Pan", SKU = $"{company.CompanyCode}-ENG-TPAN", CategoryId = categories[1].Id, DefaultPrice = 42.00m, DefaultRequiresSandblasting = true, DefaultRequiresMasking = true, DefaultEstimatedMinutes = 40, DisplayOrder = 8, IsActive = true, CompanyId = company.Id, CreatedAt = DateTime.UtcNow },

            // Outdoor Furniture (7 items)
            new CatalogItem { Name = "Patio Chair Frame", SKU = $"{company.CompanyCode}-FURN-CHAIR", CategoryId = categories[2].Id, DefaultPrice = 40.00m, DefaultRequiresSandblasting = true, DefaultRequiresMasking = false, DefaultEstimatedMinutes = 30, DisplayOrder = 1, IsActive = true, CompanyId = company.Id, CreatedAt = DateTime.UtcNow },
            new CatalogItem { Name = "Patio Table Frame (Small)", SKU = $"{company.CompanyCode}-FURN-TBLS", CategoryId = categories[2].Id, DefaultPrice = 75.00m, DefaultRequiresSandblasting = true, DefaultRequiresMasking = false, DefaultEstimatedMinutes = 50, DisplayOrder = 2, IsActive = true, CompanyId = company.Id, CreatedAt = DateTime.UtcNow },
            new CatalogItem { Name = "Patio Table Frame (Large)", SKU = $"{company.CompanyCode}-FURN-TBLL", CategoryId = categories[2].Id, DefaultPrice = 95.00m, DefaultRequiresSandblasting = true, DefaultRequiresMasking = false, DefaultEstimatedMinutes = 65, DisplayOrder = 3, IsActive = true, CompanyId = company.Id, CreatedAt = DateTime.UtcNow },
            new CatalogItem { Name = "Bench Frame", SKU = $"{company.CompanyCode}-FURN-BENCH", CategoryId = categories[2].Id, DefaultPrice = 85.00m, DefaultRequiresSandblasting = true, DefaultRequiresMasking = false, DefaultEstimatedMinutes = 55, DisplayOrder = 4, IsActive = true, CompanyId = company.Id, CreatedAt = DateTime.UtcNow },
            new CatalogItem { Name = "Umbrella Stand", SKU = $"{company.CompanyCode}-FURN-UMBR", CategoryId = categories[2].Id, DefaultPrice = 45.00m, DefaultRequiresSandblasting = true, DefaultRequiresMasking = false, DefaultEstimatedMinutes = 25, DisplayOrder = 5, IsActive = true, CompanyId = company.Id, CreatedAt = DateTime.UtcNow },
            new CatalogItem { Name = "Planter Box Frame", SKU = $"{company.CompanyCode}-FURN-PLTR", CategoryId = categories[2].Id, DefaultPrice = 55.00m, DefaultRequiresSandblasting = true, DefaultRequiresMasking = false, DefaultEstimatedMinutes = 35, DisplayOrder = 6, IsActive = true, CompanyId = company.Id, CreatedAt = DateTime.UtcNow },
            new CatalogItem { Name = "Garden Trellis", SKU = $"{company.CompanyCode}-FURN-TREL", CategoryId = categories[2].Id, DefaultPrice = 65.00m, DefaultRequiresSandblasting = true, DefaultRequiresMasking = false, DefaultEstimatedMinutes = 40, DisplayOrder = 7, IsActive = true, CompanyId = company.Id, CreatedAt = DateTime.UtcNow },

            // Railings & Handrails (8 items)
            new CatalogItem { Name = "Railing Section (Linear Foot)", SKU = $"{company.CompanyCode}-RAIL-LF", CategoryId = categories[3].Id, DefaultPrice = 12.00m, DefaultRequiresSandblasting = true, DefaultRequiresMasking = false, DefaultEstimatedMinutes = 8, DisplayOrder = 1, IsActive = true, CompanyId = company.Id, CreatedAt = DateTime.UtcNow },
            new CatalogItem { Name = "Stair Railing (Per Step)", SKU = $"{company.CompanyCode}-RAIL-STEP", CategoryId = categories[3].Id, DefaultPrice = 18.00m, DefaultRequiresSandblasting = true, DefaultRequiresMasking = false, DefaultEstimatedMinutes = 12, DisplayOrder = 2, IsActive = true, CompanyId = company.Id, CreatedAt = DateTime.UtcNow },
            new CatalogItem { Name = "Baluster (Each)", SKU = $"{company.CompanyCode}-RAIL-BAL", CategoryId = categories[3].Id, DefaultPrice = 5.00m, DefaultRequiresSandblasting = true, DefaultRequiresMasking = false, DefaultEstimatedMinutes = 3, DisplayOrder = 3, IsActive = true, CompanyId = company.Id, CreatedAt = DateTime.UtcNow },
            new CatalogItem { Name = "Newel Post", SKU = $"{company.CompanyCode}-RAIL-POST", CategoryId = categories[3].Id, DefaultPrice = 35.00m, DefaultRequiresSandblasting = true, DefaultRequiresMasking = false, DefaultEstimatedMinutes = 20, DisplayOrder = 4, IsActive = true, CompanyId = company.Id, CreatedAt = DateTime.UtcNow },
            new CatalogItem { Name = "Decorative Finial", SKU = $"{company.CompanyCode}-RAIL-FIN", CategoryId = categories[3].Id, DefaultPrice = 15.00m, DefaultRequiresSandblasting = true, DefaultRequiresMasking = true, DefaultEstimatedMinutes = 12, DisplayOrder = 5, IsActive = true, CompanyId = company.Id, CreatedAt = DateTime.UtcNow },
            new CatalogItem { Name = "Wall-Mount Bracket", SKU = $"{company.CompanyCode}-RAIL-BRKT", CategoryId = categories[3].Id, DefaultPrice = 8.00m, DefaultRequiresSandblasting = true, DefaultRequiresMasking = false, DefaultEstimatedMinutes = 5, DisplayOrder = 6, IsActive = true, CompanyId = company.Id, CreatedAt = DateTime.UtcNow },
            new CatalogItem { Name = "Corner Post Assembly", SKU = $"{company.CompanyCode}-RAIL-CRNR", CategoryId = categories[3].Id, DefaultPrice = 42.00m, DefaultRequiresSandblasting = true, DefaultRequiresMasking = false, DefaultEstimatedMinutes = 25, DisplayOrder = 7, IsActive = true, CompanyId = company.Id, CreatedAt = DateTime.UtcNow },
            new CatalogItem { Name = "Ornamental Panel Insert", SKU = $"{company.CompanyCode}-RAIL-PNL", CategoryId = categories[3].Id, DefaultPrice = 28.00m, DefaultRequiresSandblasting = true, DefaultRequiresMasking = true, DefaultEstimatedMinutes = 18, DisplayOrder = 8, IsActive = true, CompanyId = company.Id, CreatedAt = DateTime.UtcNow },

            // Gates & Fencing (7 items)
            new CatalogItem { Name = "Single Gate (3' x 4')", SKU = $"{company.CompanyCode}-GATE-S34", CategoryId = categories[4].Id, DefaultPrice = 150.00m, DefaultRequiresSandblasting = true, DefaultRequiresMasking = false, DefaultEstimatedMinutes = 90, DisplayOrder = 1, IsActive = true, CompanyId = company.Id, CreatedAt = DateTime.UtcNow },
            new CatalogItem { Name = "Single Gate (4' x 6')", SKU = $"{company.CompanyCode}-GATE-S46", CategoryId = categories[4].Id, DefaultPrice = 195.00m, DefaultRequiresSandblasting = true, DefaultRequiresMasking = false, DefaultEstimatedMinutes = 110, DisplayOrder = 2, IsActive = true, CompanyId = company.Id, CreatedAt = DateTime.UtcNow },
            new CatalogItem { Name = "Double Gate (8' x 6')", SKU = $"{company.CompanyCode}-GATE-D86", CategoryId = categories[4].Id, DefaultPrice = 325.00m, DefaultRequiresSandblasting = true, DefaultRequiresMasking = false, DefaultEstimatedMinutes = 180, DisplayOrder = 3, IsActive = true, CompanyId = company.Id, CreatedAt = DateTime.UtcNow },
            new CatalogItem { Name = "Fence Panel (6' x 4')", SKU = $"{company.CompanyCode}-FENCE-64", CategoryId = categories[4].Id, DefaultPrice = 95.00m, DefaultRequiresSandblasting = true, DefaultRequiresMasking = false, DefaultEstimatedMinutes = 55, DisplayOrder = 4, IsActive = true, CompanyId = company.Id, CreatedAt = DateTime.UtcNow },
            new CatalogItem { Name = "Fence Panel (8' x 6')", SKU = $"{company.CompanyCode}-FENCE-86", CategoryId = categories[4].Id, DefaultPrice = 125.00m, DefaultRequiresSandblasting = true, DefaultRequiresMasking = false, DefaultEstimatedMinutes = 70, DisplayOrder = 5, IsActive = true, CompanyId = company.Id, CreatedAt = DateTime.UtcNow },
            new CatalogItem { Name = "Gate/Fence Post", SKU = $"{company.CompanyCode}-FENCE-POST", CategoryId = categories[4].Id, DefaultPrice = 32.00m, DefaultRequiresSandblasting = true, DefaultRequiresMasking = false, DefaultEstimatedMinutes = 18, DisplayOrder = 6, IsActive = true, CompanyId = company.Id, CreatedAt = DateTime.UtcNow },
            new CatalogItem { Name = "Decorative Gate Topper", SKU = $"{company.CompanyCode}-GATE-TOP", CategoryId = categories[4].Id, DefaultPrice = 45.00m, DefaultRequiresSandblasting = true, DefaultRequiresMasking = true, DefaultEstimatedMinutes = 25, DisplayOrder = 7, IsActive = true, CompanyId = company.Id, CreatedAt = DateTime.UtcNow },

            // Fitness Equipment (5 items)
            new CatalogItem { Name = "Weight Rack Frame", SKU = $"{company.CompanyCode}-FIT-RACK", CategoryId = categories[5].Id, DefaultPrice = 185.00m, DefaultRequiresSandblasting = true, DefaultRequiresMasking = false, DefaultEstimatedMinutes = 100, DisplayOrder = 1, IsActive = true, CompanyId = company.Id, CreatedAt = DateTime.UtcNow },
            new CatalogItem { Name = "Bench Press Frame", SKU = $"{company.CompanyCode}-FIT-BENCH", CategoryId = categories[5].Id, DefaultPrice = 145.00m, DefaultRequiresSandblasting = true, DefaultRequiresMasking = false, DefaultEstimatedMinutes = 85, DisplayOrder = 2, IsActive = true, CompanyId = company.Id, CreatedAt = DateTime.UtcNow },
            new CatalogItem { Name = "Cable Machine Frame", SKU = $"{company.CompanyCode}-FIT-CABLE", CategoryId = categories[5].Id, DefaultPrice = 225.00m, DefaultRequiresSandblasting = true, DefaultRequiresMasking = false, DefaultEstimatedMinutes = 130, DisplayOrder = 3, IsActive = true, CompanyId = company.Id, CreatedAt = DateTime.UtcNow },
            new CatalogItem { Name = "Dumbbell Stand", SKU = $"{company.CompanyCode}-FIT-DBSTD", CategoryId = categories[5].Id, DefaultPrice = 95.00m, DefaultRequiresSandblasting = true, DefaultRequiresMasking = false, DefaultEstimatedMinutes = 55, DisplayOrder = 4, IsActive = true, CompanyId = company.Id, CreatedAt = DateTime.UtcNow },
            new CatalogItem { Name = "Pull-Up Bar Frame", SKU = $"{company.CompanyCode}-FIT-PULLUP", CategoryId = categories[5].Id, DefaultPrice = 110.00m, DefaultRequiresSandblasting = true, DefaultRequiresMasking = false, DefaultEstimatedMinutes = 65, DisplayOrder = 5, IsActive = true, CompanyId = company.Id, CreatedAt = DateTime.UtcNow },

            // Office & Commercial (5 items)
            new CatalogItem { Name = "Office Desk Frame", SKU = $"{company.CompanyCode}-OFF-DESK", CategoryId = categories[6].Id, DefaultPrice = 125.00m, DefaultRequiresSandblasting = true, DefaultRequiresMasking = false, DefaultEstimatedMinutes = 70, DisplayOrder = 1, IsActive = true, CompanyId = company.Id, CreatedAt = DateTime.UtcNow },
            new CatalogItem { Name = "Filing Cabinet Frame", SKU = $"{company.CompanyCode}-OFF-FILE", CategoryId = categories[6].Id, DefaultPrice = 95.00m, DefaultRequiresSandblasting = true, DefaultRequiresMasking = false, DefaultEstimatedMinutes = 55, DisplayOrder = 2, IsActive = true, CompanyId = company.Id, CreatedAt = DateTime.UtcNow },
            new CatalogItem { Name = "Shelving Unit (5-Tier)", SKU = $"{company.CompanyCode}-OFF-SHELF", CategoryId = categories[6].Id, DefaultPrice = 115.00m, DefaultRequiresSandblasting = true, DefaultRequiresMasking = false, DefaultEstimatedMinutes = 65, DisplayOrder = 3, IsActive = true, CompanyId = company.Id, CreatedAt = DateTime.UtcNow },
            new CatalogItem { Name = "Display Rack", SKU = $"{company.CompanyCode}-OFF-DISP", CategoryId = categories[6].Id, DefaultPrice = 85.00m, DefaultRequiresSandblasting = true, DefaultRequiresMasking = false, DefaultEstimatedMinutes = 50, DisplayOrder = 4, IsActive = true, CompanyId = company.Id, CreatedAt = DateTime.UtcNow },
            new CatalogItem { Name = "Safety Railing/Barrier", SKU = $"{company.CompanyCode}-OFF-SAFE", CategoryId = categories[6].Id, DefaultPrice = 145.00m, DefaultRequiresSandblasting = true, DefaultRequiresMasking = false, DefaultEstimatedMinutes = 80, DisplayOrder = 5, IsActive = true, CompanyId = company.Id, CreatedAt = DateTime.UtcNow },

            // Shop Merchandise (10 items)
            new CatalogItem { Name = "T-Shirt (S/M/L)", SKU = $"{company.CompanyCode}-MERCH-TEE-S", CategoryId = categories[7].Id, DefaultPrice = 15.00m, DefaultRequiresSandblasting = false, DefaultRequiresMasking = false, DefaultEstimatedMinutes = 0, DisplayOrder = 1, IsActive = true, CompanyId = company.Id, CreatedAt = DateTime.UtcNow },
            new CatalogItem { Name = "T-Shirt (XL)", SKU = $"{company.CompanyCode}-MERCH-TEE-XL", CategoryId = categories[7].Id, DefaultPrice = 17.00m, DefaultRequiresSandblasting = false, DefaultRequiresMasking = false, DefaultEstimatedMinutes = 0, DisplayOrder = 2, IsActive = true, CompanyId = company.Id, CreatedAt = DateTime.UtcNow },
            new CatalogItem { Name = "T-Shirt (2XL/3XL)", SKU = $"{company.CompanyCode}-MERCH-TEE-2X", CategoryId = categories[7].Id, DefaultPrice = 19.00m, DefaultRequiresSandblasting = false, DefaultRequiresMasking = false, DefaultEstimatedMinutes = 0, DisplayOrder = 3, IsActive = true, CompanyId = company.Id, CreatedAt = DateTime.UtcNow },
            new CatalogItem { Name = "Hoodie", SKU = $"{company.CompanyCode}-MERCH-HOOD", CategoryId = categories[7].Id, DefaultPrice = 45.00m, DefaultRequiresSandblasting = false, DefaultRequiresMasking = false, DefaultEstimatedMinutes = 0, DisplayOrder = 4, IsActive = true, CompanyId = company.Id, CreatedAt = DateTime.UtcNow },
            new CatalogItem { Name = "Trucker Hat", SKU = $"{company.CompanyCode}-MERCH-HAT-T", CategoryId = categories[7].Id, DefaultPrice = 22.00m, DefaultRequiresSandblasting = false, DefaultRequiresMasking = false, DefaultEstimatedMinutes = 0, DisplayOrder = 5, IsActive = true, CompanyId = company.Id, CreatedAt = DateTime.UtcNow },
            new CatalogItem { Name = "Snapback Hat", SKU = $"{company.CompanyCode}-MERCH-HAT-S", CategoryId = categories[7].Id, DefaultPrice = 28.00m, DefaultRequiresSandblasting = false, DefaultRequiresMasking = false, DefaultEstimatedMinutes = 0, DisplayOrder = 6, IsActive = true, CompanyId = company.Id, CreatedAt = DateTime.UtcNow },
            new CatalogItem { Name = "Sticker Pack (5-pack)", SKU = $"{company.CompanyCode}-MERCH-STICKER", CategoryId = categories[7].Id, DefaultPrice = 8.00m, DefaultRequiresSandblasting = false, DefaultRequiresMasking = false, DefaultEstimatedMinutes = 0, DisplayOrder = 7, IsActive = true, CompanyId = company.Id, CreatedAt = DateTime.UtcNow },
            new CatalogItem { Name = "Can Koozie", SKU = $"{company.CompanyCode}-MERCH-KOOZ", CategoryId = categories[7].Id, DefaultPrice = 5.00m, DefaultRequiresSandblasting = false, DefaultRequiresMasking = false, DefaultEstimatedMinutes = 0, DisplayOrder = 8, IsActive = true, CompanyId = company.Id, CreatedAt = DateTime.UtcNow },
            new CatalogItem { Name = "Powder Coat Color Sample Board", SKU = $"{company.CompanyCode}-MERCH-SMPL", CategoryId = categories[7].Id, DefaultPrice = 25.00m, DefaultRequiresSandblasting = false, DefaultRequiresMasking = false, DefaultEstimatedMinutes = 0, DisplayOrder = 9, IsActive = true, CompanyId = company.Id, CreatedAt = DateTime.UtcNow },
            new CatalogItem { Name = "Gift Card", SKU = $"{company.CompanyCode}-MERCH-GIFT", CategoryId = categories[7].Id, DefaultPrice = 50.00m, DefaultRequiresSandblasting = false, DefaultRequiresMasking = false, DefaultEstimatedMinutes = 0, DisplayOrder = 10, IsActive = true, CompanyId = company.Id, CreatedAt = DateTime.UtcNow }
        };

        await _context.Set<CatalogItem>().AddRangeAsync(items);
        await _context.SaveChangesAsync();

        return items.Count;
    }
}
