SET time_zone = '+00:00';

INSERT INTO tenants (name, status, plan_code) VALUES ('Empresa XYZ', 'active', 'starter_50');

INSERT INTO roles (code, name) VALUES
('superadmin','Super Admin'),
('tenant_admin','Admin Tenant'),
('analyst','Analista'),
('client_readonly','Cliente (solo lectura)');

-- 1) Genera el hash con: php tools/make_hash.php "Admin123!"
-- 2) Pega el hash en el INSERT de abajo.
-- INSERT INTO users (tenant_id, email, display_name, password_hash, status)
-- VALUES (1, 'admin@aureaport.local', 'Admin', '<PEGAR_HASH_AQUI>', 'active');
-- Luego:
-- INSERT INTO user_roles (user_id, role_id) SELECT 1, r.id FROM roles r WHERE r.code='tenant_admin';

-- Demo mínimo
INSERT INTO clients (tenant_id, code, name, status) VALUES
(1,'ABC','ABC Inversores','active'),
(1,'PEREZ','Cliente Pérez','active'),
(1,'GLOBAL','Global Corp','active');

INSERT INTO portfolios (tenant_id, client_id, name, status) VALUES
(1,1,'Fondo ABC','active'),
(1,2,'Port. Pérez','active'),
(1,3,'Portafolio Global','active');

INSERT INTO assets (tenant_id, ticker, name, currency, status) VALUES
(1,'AMXL.MX','América Móvil','MXN','active'),
(1,'WALMEX.MX','Walmex','MXN','active'),
(1,'BIMBOA.MX','Grupo Bimbo','MXN','active');

INSERT INTO uploads (tenant_id, user_id, filename, kind, status, total_rows, ok_rows, error_rows)
VALUES (1,1,'demo_prices.csv','prices','done',120,120,0);

INSERT INTO runs (tenant_id, portfolio_id, status, params_json)
VALUES (1,1,'done', JSON_OBJECT('demo', true));
