-- Insertar lotes del Manzano 14 (M14)
-- Proyecto ID: 1 (Colinas del Lago)
-- Fase ID: 2 (Fase 2 - color naranja #f9c6aa)
-- Estado: especiales (available = 11)
-- Excluye el lote 14 (marcado con círculo en el plano)

INSERT INTO mod_rems_lots 
(mod_rems_lots_block, mod_rems_lots_number, mod_rems_lots_phase_id, mod_rems_lots_name, mod_rems_lots_area_m2, mod_rems_lots_available, mod_rems_lots_status, mod_rems_lots_project_id, mod_rems_lots_coordinates, mod_rems_lots_details, mod_rems_lots_state) 
VALUES
('M14', 1, 2, 'Lote 1-M16', 0, 11, 'especiales', 1, '', '', 1),
('M14', 2, 2, 'Lote 2-M16', 0, 11, 'especiales', 1, '', '', 1),
('M14', 3, 2, 'Lote 3-M16', 0, 11, 'especiales', 1, '', '', 1),
('M14', 4, 2, 'Lote 4-M16', 0, 11, 'especiales', 1, '', '', 1),
('M14', 5, 2, 'Lote 5-M16', 0, 11, 'especiales', 1, '', '', 1),
('M14', 6, 2, 'Lote 6-M16', 0, 11, 'especiales', 1, '', '', 1),
('M14', 7, 2, 'Lote 7-M16', 0, 11, 'especiales', 1, '', '', 1),
('M14', 8, 2, 'Lote 8-M16', 0, 11, 'especiales', 1, '', '', 1),
('M14', 9, 2, 'Lote 9-M16', 0, 11, 'especiales', 1, '', '', 1),
('M14', 10, 2, 'Lote 10-M16', 0, 11, 'especiales', 1, '', '', 1),
('M14', 11, 2, 'Lote 11-M16', 0, 11, 'especiales', 1, '', '', 1),
('M14', 12, 2, 'Lote 12-M16', 0, 11, 'especiales', 1, '', '', 1),
('M14', 13, 2, 'Lote 13-M16', 0, 11, 'especiales', 1, '', '', 1),
('M14', 15, 2, 'Lote 15-M16', 0, 11, 'especiales', 1, '', '', 1),
('M14', 16, 2, 'Lote 16-M16', 0, 11, 'especiales', 1, '', '', 1),
('M14', 17, 2, 'Lote 17-M16', 0, 11, 'especiales', 1, '', '', 1),
('M14', 40, 2, 'Lote 40-M16', 0, 11, 'especiales', 1, '', '', 1);
-- Lote 14 excluido (marcado con círculo en el plano)

-- UPDATE para cambiar fase y estado de lotes existentes del M14 (si ya están cargados)
UPDATE mod_rems_lots 
SET mod_rems_lots_phase_id = 2,
    mod_rems_lots_status = 'especiales',
    mod_rems_lots_available = 11
WHERE mod_rems_lots_project_id = 1 
AND mod_rems_lots_block = 'M14'
AND mod_rems_lots_number IN (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,15, 16, 17, 40);

-- Regenerar el archivo JSON después de insertar
-- Ejecutar desde PHP: $lotsClass->writeLotsJsonByProject(1);


INSERT INTO mod_rems_lots 
(mod_rems_lots_block, mod_rems_lots_number, mod_rems_lots_phase_id, mod_rems_lots_name, mod_rems_lots_area_m2, mod_rems_lots_available, mod_rems_lots_status, mod_rems_lots_project_id, mod_rems_lots_coordinates, mod_rems_lots_details, mod_rems_lots_state) 
VALUES
('M10', 15, 2, 'Lote 15-M10', 0, 11, 'especiales', 1, '', '', 1),
('M10', 16, 2, 'Lote 16-M10', 0, 11, 'especiales', 1, '', '', 1),
('M10', 17, 2, 'Lote 17-M10', 0, 11, 'especiales', 1, '', '', 1),
('M10', 18, 2, 'Lote 18-M10', 0, 11, 'especiales', 1, '', '', 1),
('M10', 19, 2, 'Lote 19-M10', 0, 11, 'especiales', 1, '', '', 1);


INSERT INTO mod_rems_lots 
(mod_rems_lots_block, mod_rems_lots_number, mod_rems_lots_phase_id, mod_rems_lots_name, mod_rems_lots_area_m2, mod_rems_lots_available, mod_rems_lots_status, mod_rems_lots_project_id, mod_rems_lots_coordinates, mod_rems_lots_details, mod_rems_lots_state) 
VALUES
('M11', 12, 2, 'Lote 12-M11', 0, 11, 'especiales', 1, '', '', 1),
('M11', 13, 2, 'Lote 13-M11', 0, 11, 'especiales', 1, '', '', 1);


INSERT INTO mod_rems_lots 
(mod_rems_lots_block, mod_rems_lots_number, mod_rems_lots_phase_id, mod_rems_lots_name, mod_rems_lots_area_m2, mod_rems_lots_available, mod_rems_lots_status, mod_rems_lots_project_id, mod_rems_lots_coordinates, mod_rems_lots_details, mod_rems_lots_state) 
VALUES
('M13', 128, 2, 'Lote 128-M13', 0, 11, 'especiales', 1, '', '', 1),
('M13', 129, 2, 'Lote 129-M13', 0, 11, 'especiales', 1, '', '', 1),
('M13', 130, 2, 'Lote 130-M13', 0, 11, 'especiales', 1, '', '', 1),
('M13', 131, 2, 'Lote 131-M13', 0, 11, 'especiales', 1, '', '', 1),
('M13', 132, 2, 'Lote 132-M13', 0, 11, 'especiales', 1, '', '', 1),
('M13', 133, 2, 'Lote 133-M13', 0, 11, 'especiales', 1, '', '', 1),
('M13', 134, 2, 'Lote 134-M13', 0, 11, 'especiales', 1, '', '', 1),
('M13', 135, 2, 'Lote 135-M13', 0, 11, 'especiales', 1, '', '', 1),
('M13', 136, 2, 'Lote 136-M13', 0, 11, 'especiales', 1, '', '', 1),
('M13', 138, 2, 'Lote 138-M13', 0, 11, 'especiales', 1, '', '', 1),
('M13', 139, 2, 'Lote 139-M13', 0, 11, 'especiales', 1, '', '', 1),
('M13', 140, 2, 'Lote 140-M13', 0, 11, 'especiales', 1, '', '', 1),
('M13', 141, 2, 'Lote 141-M13', 0, 11, 'especiales', 1, '', '', 1),
('M13', 142, 2, 'Lote 142-M13', 0, 11, 'especiales', 1, '', '', 1),
('M13', 143, 2, 'Lote 143-M13', 0, 11, 'especiales', 1, '', '', 1),
('M13', 144, 2, 'Lote 144-M13', 0, 11, 'especiales', 1, '', '', 1);


-- UPDATE para cambiar disponibilidad a NEGOCIACIÓN (available = 3, status = 'en_negociacion')
-- Manzano 9 (M9) - Lotes 20, 21, 22, 23
UPDATE mod_rems_lots 
SET mod_rems_lots_available = 3,
    mod_rems_lots_status = 'en_negociacion'
WHERE mod_rems_lots_project_id = 1 
AND mod_rems_lots_block = 'M09'
AND mod_rems_lots_number IN (20, 21, 22, 23);

-- Manzano 15 (M15) - Lotes 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23
UPDATE mod_rems_lots 
SET mod_rems_lots_available = 3,
    mod_rems_lots_status = 'en_negociacion'
WHERE mod_rems_lots_project_id = 1 
AND mod_rems_lots_block = 'M15'
AND mod_rems_lots_number IN (5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23);

-- Regenerar el archivo JSON después de ejecutar los updates
-- Ejecutar desde PHP: $lotsClass->writeLotsJsonByProject(1);

