-- Aggie-server counterpart of seed_asset_categories.sql (DATA ONLY).
-- Seeds the starter categories for EVERY existing tenant (not a single hardcoded tenant id,
-- since Aggie hosts multiple tenants) via a cross-join against the tenants table.
-- Idempotent — INSERT IGNORE against the (tenant_id, name) unique key, safe to re-run.
-- Deploy: mysql -u <user> -p 'stacie_Aggie_v1.0' < db/aggie_seed_asset_categories.sql

USE `stacie_Aggie_v1.0`;

INSERT IGNORE INTO dim_asset_categories (tenant_id, name, is_active, created_at, updated_at)
SELECT t.id, c.name, 1, NOW(), NOW()
FROM tenants t
CROSS JOIN (
    SELECT 'Software' AS name UNION ALL SELECT 'SaaS' UNION ALL SELECT 'Server' UNION ALL
    SELECT 'License' UNION ALL SELECT 'Domain' UNION ALL SELECT 'Insurance' UNION ALL
    SELECT 'State Reports' UNION ALL SELECT 'Trademarks IP' UNION ALL SELECT 'SaaS-Tech' UNION ALL
    SELECT 'Federal License' UNION ALL SELECT 'Compliance' UNION ALL SELECT 'Dept of Labor' UNION ALL
    SELECT 'Reports' UNION ALL SELECT 'Other'
) c
WHERE t.is_deleted = 0;
