-- Script Corrigido de Insercao de Dados de Teste

-- Inserir 2 ministerios adicionais
INSERT INTO ministry (id, code, name, created_at, updated_at) VALUES
('22222222-2222-2222-2222-222222222222', 'MIN-002', 'Ministerio da Saude Publica', now(), now()),
('33333333-3333-3333-3333-333333333333', 'MIN-003', 'Ministerio da Educacao Nacional', now(), now());

-- Inserir unidades organicas para os novos ministerios
INSERT INTO org_unit (id, code, name, ministry_id, parent_id, created_at, updated_at) VALUES
('44444444-4444-4444-4444-444444444444', 'UO-001', 'Direcao-Geral do Tesouro', (SELECT id FROM ministry WHERE code = 'MIN-001'), NULL, now(), now()),
('55555555-5555-5555-5555-555555555555', 'UO-002', 'Direcao-Geral do Orcamento', (SELECT id FROM ministry WHERE code = 'MIN-001'), NULL, now(), now()),
('66666666-6666-6666-6666-666666666666', 'UO-003', 'Hospital Nacional Simao Mendes', '22222222-2222-2222-2222-222222222222', NULL, now(), now()),
('77777777-7777-7777-7777-777777777777', 'UO-004', 'Escola Secundaria de Bissau', '33333333-3333-3333-3333-333333333333', NULL, now(), now());

-- Inserir cargos adicionais (SEM description)
INSERT INTO position (id, code, title, created_at, updated_at) VALUES
('88888888-8888-8888-8888-888888888888', 'CAR-005', 'Diretor-Geral', now(), now()),
('99999999-9999-9999-9999-999999999999', 'CAR-006', 'Tecnico Superior', now(), now()),
('aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa', 'CAR-007', 'Medico Especialista', now(), now()),
('bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb', 'CAR-008', 'Professor', now(), now());

-- Verificar resultados
SELECT 'MINISTERIOS' as tipo, COUNT(*)::text as total FROM ministry
UNION ALL
SELECT 'UNIDADES ORGANICAS', COUNT(*)::text FROM org_unit
UNION ALL
SELECT 'CARGOS', COUNT(*)::text FROM position
UNION ALL
SELECT 'BANCOS', COUNT(*)::text FROM bank
UNION ALL
SELECT 'AGENTES', COUNT(*)::text FROM agents;
