-- Insert dummy version data for pos_terminal_version table
-- Each serial number gets 2-3 version entries with the latest marked as active

-- Serial: 123-123-123
INSERT INTO pos_terminal_version (serial_no, param_version, emv_version, key_version, application_version, is_active, inserted_at, updated_at)
VALUES 
('123-123-123', '1.0.0', '2.0.0', '1.0.0', '3.5.0', false, '2026-01-15 10:00:00', '2026-01-15 10:00:00'),
('123-123-123', '1.1.0', '2.1.5', '1.1.0', '3.6.0', false, '2026-02-10 14:30:00', '2026-02-10 14:30:00'),
('123-123-123', '1.2.0', '2.2.1', '1.2.0', '3.7.0', true,  '2026-03-01 09:15:00', '2026-03-01 09:15:00');

-- Serial: 98251226730002
INSERT INTO pos_terminal_version (serial_no, param_version, emv_version, key_version, application_version, is_active, inserted_at, updated_at)
VALUES 
('98251226730002', '0.9.5', '1.8.2', '0.9.0', '3.3.0', false, '2026-01-10 08:30:00', '2026-01-10 08:30:00'),
('98251226730002', '1.0.2', '2.0.1', '1.0.5', '3.5.5', false, '2026-02-05 11:20:00', '2026-02-05 11:20:00'),
('98251226730002', '1.2.5', '2.3.0', '1.2.3', '3.7.5', true,  '2026-03-05 13:45:00', '2026-03-05 13:45:00');

-- Serial: 98250623730001
INSERT INTO pos_terminal_version (serial_no, param_version, emv_version, key_version, application_version, is_active, inserted_at, updated_at)
VALUES 
('98250623730001', '1.0.0', '2.1.0', '1.0.1', '3.4.0', false, '2026-01-20 12:00:00', '2026-01-20 12:00:00'),
('98250623730001', '1.1.3', '2.2.2', '1.1.5', '3.6.2', false, '2026-02-15 15:30:00', '2026-02-15 15:30:00'),
('98250623730001', '1.2.2', '2.3.5', '1.2.5', '3.7.3', true,  '2026-03-10 10:00:00', '2026-03-10 10:00:00');

-- Additional test serial numbers with different version patterns

-- Serial: TEST001 (newer versions)
INSERT INTO pos_terminal_version (serial_no, param_version, emv_version, key_version, application_version, is_active, inserted_at, updated_at)
VALUES 
('TEST001', '1.5.0', '2.5.0', '1.5.0', '4.0.0', false, '2026-02-01 09:00:00', '2026-02-01 09:00:00'),
('TEST001', '1.6.2', '2.6.1', '1.6.0', '4.1.0', false, '2026-02-20 14:00:00', '2026-02-20 14:00:00'),
('TEST001', '1.7.0', '2.7.0', '1.7.0', '4.2.0', true,  '2026-03-15 11:30:00', '2026-03-15 11:30:00');

-- Serial: TEST002 (lower versions for testing)
INSERT INTO pos_terminal_version (serial_no, param_version, emv_version, key_version, application_version, is_active, inserted_at, updated_at)
VALUES 
('TEST002', '0.8.0', '1.5.0', '0.8.0', '3.0.0', false, '2026-01-05 07:00:00', '2026-01-05 07:00:00'),
('TEST002', '0.9.0', '1.7.5', '0.9.2', '3.2.0', false, '2026-02-01 10:00:00', '2026-02-01 10:00:00'),
('TEST002', '1.0.5', '2.0.0', '1.0.0', '3.5.0', true,  '2026-03-01 08:00:00', '2026-03-01 08:00:00');

-- Verification query to check the inserted data
-- Uncomment to run after insert:
-- SELECT serial_no, param_version, emv_version, key_version, application_version, is_active, inserted_at
-- FROM pos_terminal_version
-- ORDER BY serial_no, inserted_at DESC;
