-- ============================================================================
-- ERP GENERIC - SEED DATA: TENANTS (Development)
-- ============================================================================
-- Description: Initial tenants for development environment
-- ============================================================================

-- Default tenant for development
INSERT INTO auth.tenants (id, name, subdomain, schema_name, status, settings, plan, max_users, created_at)
VALUES (
    '1c7dfbb0-19b8-4e87-a225-a74da6f26dbf',
    'Demo Company',
    'demo',
    'tenant_demo',
    'active',
    jsonb_build_object(
        'locale', 'es_MX',
        'timezone', 'America/Mexico_City',
        'currency', 'MXN',
        'date_format', 'DD/MM/YYYY'
    ),
    'pro',
    50,
    CURRENT_TIMESTAMP
) ON CONFLICT (id) DO NOTHING;

-- Second tenant for multi-tenancy testing
INSERT INTO auth.tenants (id, name, subdomain, schema_name, status, settings, plan, max_users, created_at)
VALUES (
    '204c4748-09b2-4a98-bb5a-183ec263f205',
    'Test Corporation',
    'test-corp',
    'tenant_test_corp',
    'active',
    jsonb_build_object(
        'locale', 'en_US',
        'timezone', 'America/New_York',
        'currency', 'USD',
        'date_format', 'MM/DD/YYYY'
    ),
    'basic',
    10,
    CURRENT_TIMESTAMP
) ON CONFLICT (id) DO NOTHING;

-- Output confirmation
DO $$
BEGIN
    RAISE NOTICE 'Tenants seed data loaded: 2 tenants created';
END $$;
