
-- ===================================================
-- INSERT Statements für system_property_type
-- Mapping: external mapping id -> external_mapping_id
--          Description -> name
-- ===================================================

INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'Reference route: Start node', 'START_REF', 'TEXT', '{}','Specifies the starting node of the reference route. A historical maximum and a historical minimum value are stored for the reference route. This reference route is used to calculate fluctuations in transport costs.','2_Reference route','1');
INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'Reference route: End node', 'END_REF', 'TEXT', '{}','Specifies the end node of the reference route. A historical maximum and a historical minimum value are stored for the reference route. This reference route is used to calculate fluctuations in transport costs.','2_Reference route','2');
INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'Reference route: All-time-high container rate (40 ft. GP) [EUR]', 'RISK_REF', 'CURRENCY', '{"GT":0}','Specifies the historically maximum container rate of the reference route for a 40 ft. GP container. A historical maximum and a historical minimum value are stored for the reference route. This reference route is used to calculate fluctuations in transport costs.','2_Reference route','3');
INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'Reference route: All-time-low container rate (40 ft. GP) [EUR]', 'CHANCE_REF', 'CURRENCY', '{"GT":0}','Specifies the historically lowest container rate of the reference route for a 40 ft. GP container. A historical maximum and a historical minimum value are stored for the reference route. This reference route is used to calculate fluctuations in transport costs.','2_Reference route','4');
INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'Payment terms [days]', 'PAYMENT_TERMS', 'INT', '{}','Payment terms agreed with suppliers in days. This value is used to calculate the financing costs for goods in transit and in safety stock.','1_General','3');
INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'Annual working days', 'WORKDAYS', 'INT', '{"GT": 0, "LT": 366}','Annual production working days.','1_General','2');
INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'Interest rate inventory [%]', 'INTEREST_RATE', 'PERCENTAGE', '{"GTE": 0}','Interest rate used for calculating capital costs.','1_General','4');
INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'FCA fee [%]', 'FCA_FEE', 'PERCENTAGE', '{"GTE": 0}','FCA fee to be added to EXW prices. The logistics cost expert must explicitly select this during the calculation for the fee to be applied.','1_General','5');
INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'Default customs rate [%]', 'TARIFF_RATE', 'PERCENTAGE', '{"GTE":0}','Standard customs duty rate to be applied when the HS Code cannot be resolved automatically.','1_General','6');
INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'Customs clearance fee per import & HS code [EUR]', 'CUSTOM_FEE', 'CURRENCY', '{"GTE":0}','Avg. customs clearance fee per HS code and import.','1_General','7');
INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'Standard reporting format', 'REPORTING', 'ENUMERATION', '{"ENUM":["MEK_B","MEK_C"]}','Specifies the reporting format. The MEK_C reporting format includes occasional air transports that occur with overseas production. The MEK_B reporting format hides these for reasons.','1_General','1');
INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( '40 ft.', 'FEU', 'BOOLEAN', '{}','Enable if calculation should include this container size; container rates to be maintained.','3_Sea and road transport','1');
INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( '20 ft.', 'TEU', 'BOOLEAN', '{}','Enable if calculation should include this container size; container rates to be maintained.','3_Sea and road transport','2');
INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( '40 ft. HC', 'FEU_HQ', 'BOOLEAN', '{}','Enable if calculation should include this container size; container rates to be maintained.','3_Sea and road transport','3');
INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'Container utilization in mixed containers [%]', 'CONTAINER_UTIL', 'PERCENTAGE', '{"GTE":0,"LTE":1}','Utilization degree of mixed containers (loss from stacking/packaging).','3_Sea and road transport','6');
INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'Truck utilization road transport EMEA [%]', 'TRUCK_UTIL', 'PERCENTAGE', '{"GTE":0,"LTE":1}','Utilization degree of trucks (loss from stacking/packaging).','3_Sea and road transport','8');
INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'Max validity period of container freight rates [days]', 'VALID_DAYS', 'INT', '{"GT": 0}','After the validity period expires, no logistics cost calculations are possible with the current freight rates. This mechanism ensures that freight rates are regularly updated or verified by a freight rate key user.','1_General','8');
INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'Metropolitan region size (diameter) [km]', 'RADIUS_REGION', 'INT', '{"GT": 0}','If there are no kilometer rates within a country, it is possible to use container rates from neighboring logistics nodes. However, the node must be within the metropolitan region radius.','1_General','9');
INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'Min delivery frequency / year for container transports', 'FREQ_MIN', 'INT', '{"GT": 0, "LT": 366}','Low runners: Indicates the number of annual deliveries when the annual demand is lower than the content of a handling unit (The HU is then split up)','1_General','10');
INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'Max delivery frequency / year for container transport', 'FREQ_MAX', 'INT', '{"GT": 0, "LT": 366}','High runners: Indicates the maximum number of annual deliveries. (If the annual demand exceeds this number, one delivery contains more than one HU). Please note that this value affects the storage space cost.','1_General','11');
INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'Max weight load 20 ft. container [kg]', 'TEU_LOAD', 'INT', '{"GT": 0}','Weight limit of TEU container.','3_Sea and road transport','4');
INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'Max weight load 40 ft. container [kg]', 'FEU_LOAD', 'INT', '{"GT": 0}','Weight limit of FEU container (may be restricted by law, e.g. CN truck load = 21 tons).','3_Sea and road transport','5');
INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'Max weight load truck [kg]', 'TRUCK_LOAD', 'INT', '{"GT": 0}','Weight limit of standard truck.','3_Sea and road transport','7');
INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'Pre-carriage [EUR/kg]', 'AIR_PRECARRIAGE', 'CURRENCY', '{"GTE": 0}','The pre-carriage costs per kilogram to the departure airport when calculating air freight costs.','4_Air transport','1');
INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'Pre-carriage handling [EUR]', 'AIR_HANDLING', 'CURRENCY', '{"GTE": 0}','One-time costs for processing documents in an air freight transport.','4_Air transport','2');
INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'Main carriage [EUR/kg]', 'AIR_MAINCARRIAGE', 'CURRENCY', '{"GTE": 0}','Air freight costs per kg on the route from China to Germany.','4_Air transport','3');
INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'Hand over fee [EUR]', 'AIR_HANDOVER_FEE', 'CURRENCY', '{"GTE": 0}','One-time handover costs for air freight transports.','4_Air transport','4');
INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'Customs clearance fee [EUR]', 'AIR_CUSTOM_FEE', 'CURRENCY', '{"GTE": 0}','One-time costs for customs clearance in air freight transports.','4_Air transport','5');
INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'On-carriage [EUR/kg]', 'AIR_ONCARRIAGE', 'CURRENCY', '{"GTE": 0}','On-carriage costs per kilogram from destination airport to final destination when calculating air freight costs.','4_Air transport','6');
INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'Terminal handling fee [EUR/kg]', 'AIR_TERMINAL_FEE', 'CURRENCY', '{"GTE": 0}','Terminal handling charges per kilogram for air freight transports.','4_Air transport','7');
INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'GR handling KLT [EUR/HU]', 'KLT_HANDLING', 'CURRENCY', '{"GTE": 0}','Handling costs per received small load carrier (KLTs are handling units under 0.08 m³ volume) at German wage level.','5_Warehouse','4');
INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'GR handling GLT [EUR/HU]', 'GLT_HANDLING', 'CURRENCY', '{"GTE": 0}','Handling costs per received large load carrier (GLT are handling units over 0.08 m³ volume) at German wage level.','5_Warehouse','5');
INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'GLT booking & document handling [EUR/GR]', 'BOOKING', 'CURRENCY', '{"GTE": 0}','One-time document handling fee per GLT at German wage level.','5_Warehouse','2');
INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'GLT release from storage [EUR/GLT]', 'GLT_RELEASE', 'CURRENCY', '{"GTE": 0}','Cost to release one GLT from storage at German wage level.','5_Warehouse','12');
INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'KLT release from storage [EUR/KLT]', 'KLT_RELEASE', 'CURRENCY', '{"GTE": 0}','Cost to release one KLT from storage at German wage level.','5_Warehouse','11');
INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'GLT dispatch [EUR/GLT]', 'GLT_DISPATCH', 'CURRENCY', '{"GTE": 0}','Cost to dispatch one GLT at German wage level.','5_Warehouse','14');
INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'KLT dispatch [EUR/KLT]', 'KLT_DISPATCH', 'CURRENCY', '{"GTE": 0}','Cost to dispatch one KLT at German wage level.','5_Warehouse','13');
INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'Repacking KLT, HU <15kg [EUR/HU]', 'KLT_REPACK_S', 'CURRENCY', '{"GTE": 0}','Cost to repack one KLT (with a weight under 15 kg) from one-way to returnable at German wage level.','5_Warehouse','6');
INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'Repacking KLT, HU >=15kg [EUR/HU]', 'KLT_REPACK_M', 'CURRENCY', '{"GTE": 0}','Cost to repack one KLT (with a weight under or equal 15 kg) from one-way to returnable with crane at German wage level.','5_Warehouse','7');
INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'Repacking GLT, HU <15kg [EUR/HU]', 'GLT_REPACK_S', 'CURRENCY', '{"GTE": 0}','Cost to repack one GLT (with a weight under 15 kg) from one-way to returnable at German wage level.','5_Warehouse','8');
INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'Repacking GLT, HU 15 - 2000kg [EUR/HU]', 'GLT_REPACK_M', 'CURRENCY', '{"GTE": 0}','Cost to repack one GLT (with a weight over 15 but under or equal 2000 kg) from one-way to returnable with crane at German wage level.','5_Warehouse','9');
INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'Repacking GLT, HU >2000kg [EUR/HU]', 'GLT_REPACK_L', 'INT', '{"GTE": 0}','Cost to repack one GLT (with a weight over 2000 kg) from one-way to returnable with crane at German wage level.','5_Warehouse','10');
INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'GLT disposal [EUR/GLT]', 'DISPOSAL', 'INT', '{"GTE": 0}','Cost to dispose one wooden pallet.','5_Warehouse','15');
INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'Space costs per cbm per night [EUR/cbm]', 'SPACE_COST', 'CURRENCY', '{"GTE": 0}','The storage costs incurred for a storage space of 1 square meter per started height unit (meter) and per day. E.g.: 1 Euro pallet with 1.8 m height is calculated as 1.2 x 0.8 x SPACE_COST x 2, where SPACE_COST is the entered price.','5_Warehouse','1');
INSERT INTO system_property_type ( name, external_mapping_id, data_type, validation_rule, description, property_group, sequence_number) VALUES ( 'KLT booking & document handling [EUR/GR]', 'BOOKING_KLT', 'CURRENCY', '{"GTE": 0}','One-time document handling fee per KLT at German wage level.','5_Warehouse','3');



-- ===================================================
-- INSERT Statements für system_property
-- Verwendung von Subqueries für dynamische ID-Ermittlung
-- ===================================================

INSERT INTO system_property (property_set_id, system_property_type_id, property_value)
VALUES (
           (SELECT ps.id FROM `property_set` ps
            WHERE ps.state = 'VALID'
              AND ps.start_date <= NOW()
              AND (ps.end_date IS NULL OR ps.end_date > NOW())
            ORDER BY ps.start_date DESC
            LIMIT 1),
           (SELECT spt.id FROM system_property_type spt WHERE spt.external_mapping_id = 'PAYMENT_TERMS'),
           '30'
       );

INSERT INTO system_property (property_set_id, system_property_type_id, property_value)
VALUES (
           (SELECT ps.id FROM `property_set` ps
            WHERE ps.state = 'VALID'
              AND ps.start_date <= NOW()
              AND (ps.end_date IS NULL OR ps.end_date > NOW())
            ORDER BY ps.start_date DESC
            LIMIT 1),
           (SELECT spt.id FROM system_property_type spt WHERE spt.external_mapping_id = 'START_REF'),
           'CNXMN'
       );

INSERT INTO system_property (property_set_id, system_property_type_id, property_value)
VALUES (
           (SELECT ps.id FROM `property_set` ps
            WHERE ps.state = 'VALID'
              AND ps.start_date <= NOW()
              AND (ps.end_date IS NULL OR ps.end_date > NOW())
            ORDER BY ps.start_date DESC
            LIMIT 1),
           (SELECT spt.id FROM system_property_type spt WHERE spt.external_mapping_id = 'END_REF'),
           'DEHAM'
       );

INSERT INTO system_property (property_set_id, system_property_type_id, property_value)
VALUES (
           (SELECT ps.id FROM `property_set` ps
            WHERE ps.state = 'VALID'
              AND ps.start_date <= NOW()
              AND (ps.end_date IS NULL OR ps.end_date > NOW())
            ORDER BY ps.start_date DESC
            LIMIT 1),
           (SELECT spt.id FROM system_property_type spt WHERE spt.external_mapping_id = 'RISK_REF'),
           '20000.00'
       );

INSERT INTO system_property (property_set_id, system_property_type_id, property_value)
VALUES (
           (SELECT ps.id FROM `property_set` ps
            WHERE ps.state = 'VALID'
              AND ps.start_date <= NOW()
              AND (ps.end_date IS NULL OR ps.end_date > NOW())
            ORDER BY ps.start_date DESC
            LIMIT 1),
           (SELECT spt.id FROM system_property_type spt WHERE spt.external_mapping_id = 'CHANCE_REF'),
           '1000.00'
       );


INSERT INTO system_property (property_set_id, system_property_type_id, property_value)
VALUES (
           (SELECT ps.id FROM `property_set` ps
            WHERE ps.state = 'VALID'
              AND ps.start_date <= NOW()
              AND (ps.end_date IS NULL OR ps.end_date > NOW())
            ORDER BY ps.start_date DESC
            LIMIT 1),
           (SELECT spt.id FROM system_property_type spt WHERE spt.external_mapping_id = 'TRUCK_UTIL'),
           '0.7'
       );


INSERT INTO system_property (property_set_id, system_property_type_id, property_value)
VALUES (
           (SELECT ps.id FROM `property_set` ps
            WHERE ps.state = 'VALID'
              AND ps.start_date <= NOW()
              AND (ps.end_date IS NULL OR ps.end_date > NOW())
            ORDER BY ps.start_date DESC
            LIMIT 1),
           (SELECT spt.id FROM system_property_type spt WHERE spt.external_mapping_id = 'WORKDAYS'),
           '210'
       );

INSERT INTO system_property (property_set_id, system_property_type_id, property_value)
VALUES (
           (SELECT ps.id FROM `property_set` ps
            WHERE ps.state = 'VALID'
              AND ps.start_date <= NOW()
              AND (ps.end_date IS NULL OR ps.end_date > NOW())
            ORDER BY ps.start_date DESC
            LIMIT 1),
           (SELECT spt.id FROM system_property_type spt WHERE spt.external_mapping_id = 'INTEREST_RATE'),
           '0.12'
       );

INSERT INTO system_property (property_set_id, system_property_type_id, property_value)
VALUES (
           (SELECT ps.id FROM `property_set` ps
            WHERE ps.state = 'VALID'
              AND ps.start_date <= NOW()
              AND (ps.end_date IS NULL OR ps.end_date > NOW())
            ORDER BY ps.start_date DESC
            LIMIT 1),
           (SELECT spt.id FROM system_property_type spt WHERE spt.external_mapping_id = 'FCA_FEE'),
           '0.002'
       );

INSERT INTO system_property (property_set_id, system_property_type_id, property_value)
VALUES (
           (SELECT ps.id FROM `property_set` ps
            WHERE ps.state = 'VALID'
              AND ps.start_date <= NOW()
              AND (ps.end_date IS NULL OR ps.end_date > NOW())
            ORDER BY ps.start_date DESC
            LIMIT 1),
           (SELECT spt.id FROM system_property_type spt WHERE spt.external_mapping_id = 'TARIFF_RATE'),
           '0.03'
       );

INSERT INTO system_property (property_set_id, system_property_type_id, property_value)
VALUES (
           (SELECT ps.id FROM `property_set` ps
            WHERE ps.state = 'VALID'
              AND ps.start_date <= NOW()
              AND (ps.end_date IS NULL OR ps.end_date > NOW())
            ORDER BY ps.start_date DESC
            LIMIT 1),
           (SELECT spt.id FROM system_property_type spt WHERE spt.external_mapping_id = 'CUSTOM_FEE'),
           '35'
       );

INSERT INTO system_property (property_set_id, system_property_type_id, property_value)
VALUES (
           (SELECT ps.id FROM `property_set` ps
            WHERE ps.state = 'VALID'
              AND ps.start_date <= NOW()
              AND (ps.end_date IS NULL OR ps.end_date > NOW())
            ORDER BY ps.start_date DESC
            LIMIT 1),
           (SELECT spt.id FROM system_property_type spt WHERE spt.external_mapping_id = 'REPORTING'),
           'MEK_B'
       );

INSERT INTO system_property (property_set_id, system_property_type_id, property_value)
VALUES (
           (SELECT ps.id FROM `property_set` ps
            WHERE ps.state = 'VALID'
              AND ps.start_date <= NOW()
              AND (ps.end_date IS NULL OR ps.end_date > NOW())
            ORDER BY ps.start_date DESC
            LIMIT 1),
           (SELECT spt.id FROM system_property_type spt WHERE spt.external_mapping_id = 'FEU'),
           'true'
       );

INSERT INTO system_property (property_set_id, system_property_type_id, property_value)
VALUES (
           (SELECT ps.id FROM `property_set` ps
            WHERE ps.state = 'VALID'
              AND ps.start_date <= NOW()
              AND (ps.end_date IS NULL OR ps.end_date > NOW())
            ORDER BY ps.start_date DESC
            LIMIT 1),
           (SELECT spt.id FROM system_property_type spt WHERE spt.external_mapping_id = 'TEU'),
           'true'
       );

INSERT INTO system_property (property_set_id, system_property_type_id, property_value)
VALUES (
           (SELECT ps.id FROM `property_set` ps
            WHERE ps.state = 'VALID'
              AND ps.start_date <= NOW()
              AND (ps.end_date IS NULL OR ps.end_date > NOW())
            ORDER BY ps.start_date DESC
            LIMIT 1),
           (SELECT spt.id FROM system_property_type spt WHERE spt.external_mapping_id = 'FEU_HQ'),
           'true'
       );


INSERT INTO system_property (property_set_id, system_property_type_id, property_value)
VALUES (
           (SELECT ps.id FROM `property_set` ps
            WHERE ps.state = 'VALID'
              AND ps.start_date <= NOW()
              AND (ps.end_date IS NULL OR ps.end_date > NOW())
            ORDER BY ps.start_date DESC
            LIMIT 1),
           (SELECT spt.id FROM system_property_type spt WHERE spt.external_mapping_id = 'CONTAINER_UTIL'),
           '0.7'
       );

INSERT INTO system_property (property_set_id, system_property_type_id, property_value)
VALUES (
           (SELECT ps.id FROM `property_set` ps
            WHERE ps.state = 'VALID'
              AND ps.start_date <= NOW()
              AND (ps.end_date IS NULL OR ps.end_date > NOW())
            ORDER BY ps.start_date DESC
            LIMIT 1),
           (SELECT spt.id FROM system_property_type spt WHERE spt.external_mapping_id = 'VALID_DAYS'),
           '60'
       );

INSERT INTO system_property (property_set_id, system_property_type_id, property_value)
VALUES (
           (SELECT ps.id FROM `property_set` ps
            WHERE ps.state = 'VALID'
              AND ps.start_date <= NOW()
              AND (ps.end_date IS NULL OR ps.end_date > NOW())
            ORDER BY ps.start_date DESC
            LIMIT 1),
           (SELECT spt.id FROM system_property_type spt WHERE spt.external_mapping_id = 'RADIUS_REGION'),
           '20'
       );

INSERT INTO system_property (property_set_id, system_property_type_id, property_value)
VALUES (
           (SELECT ps.id FROM `property_set` ps
            WHERE ps.state = 'VALID'
              AND ps.start_date <= NOW()
              AND (ps.end_date IS NULL OR ps.end_date > NOW())
            ORDER BY ps.start_date DESC
            LIMIT 1),
           (SELECT spt.id FROM system_property_type spt WHERE spt.external_mapping_id = 'FREQ_MIN'),
           '3'
       );

INSERT INTO system_property (property_set_id, system_property_type_id, property_value)
VALUES (
           (SELECT ps.id FROM `property_set` ps
            WHERE ps.state = 'VALID'
              AND ps.start_date <= NOW()
              AND (ps.end_date IS NULL OR ps.end_date > NOW())
            ORDER BY ps.start_date DESC
            LIMIT 1),
           (SELECT spt.id FROM system_property_type spt WHERE spt.external_mapping_id = 'FREQ_MAX'),
           '50'
       );

INSERT INTO system_property (property_set_id, system_property_type_id, property_value)
VALUES (
           (SELECT ps.id FROM `property_set` ps
            WHERE ps.state = 'VALID'
              AND ps.start_date <= NOW()
              AND (ps.end_date IS NULL OR ps.end_date > NOW())
            ORDER BY ps.start_date DESC
            LIMIT 1),
           (SELECT spt.id FROM system_property_type spt WHERE spt.external_mapping_id = 'TEU_LOAD'),
           '20000'
       );

INSERT INTO system_property (property_set_id, system_property_type_id, property_value)
VALUES (
           (SELECT ps.id FROM `property_set` ps
            WHERE ps.state = 'VALID'
              AND ps.start_date <= NOW()
              AND (ps.end_date IS NULL OR ps.end_date > NOW())
            ORDER BY ps.start_date DESC
            LIMIT 1),
           (SELECT spt.id FROM system_property_type spt WHERE spt.external_mapping_id = 'FEU_LOAD'),
           '21000'
       );
       
INSERT INTO system_property (property_set_id, system_property_type_id, property_value)
VALUES (
           (SELECT ps.id FROM `property_set` ps
            WHERE ps.state = 'VALID'
              AND ps.start_date <= NOW()
              AND (ps.end_date IS NULL OR ps.end_date > NOW())
            ORDER BY ps.start_date DESC
            LIMIT 1),
           (SELECT spt.id FROM system_property_type spt WHERE spt.external_mapping_id = 'TRUCK_LOAD'),
           '25000'
       );

INSERT INTO system_property (property_set_id, system_property_type_id, property_value)
VALUES (
           (SELECT ps.id FROM `property_set` ps
            WHERE ps.state = 'VALID'
              AND ps.start_date <= NOW()
              AND (ps.end_date IS NULL OR ps.end_date > NOW())
            ORDER BY ps.start_date DESC
            LIMIT 1),
           (SELECT spt.id FROM system_property_type spt WHERE spt.external_mapping_id = 'AIR_PRECARRIAGE'),
           '0.1'
       );

INSERT INTO system_property (property_set_id, system_property_type_id, property_value)
VALUES (
           (SELECT ps.id FROM `property_set` ps
            WHERE ps.state = 'VALID'
              AND ps.start_date <= NOW()
              AND (ps.end_date IS NULL OR ps.end_date > NOW())
            ORDER BY ps.start_date DESC
            LIMIT 1),
           (SELECT spt.id FROM system_property_type spt WHERE spt.external_mapping_id = 'AIR_HANDLING'),
           '80'
       );

INSERT INTO system_property (property_set_id, system_property_type_id, property_value)
VALUES (
           (SELECT ps.id FROM `property_set` ps
            WHERE ps.state = 'VALID'
              AND ps.start_date <= NOW()
              AND (ps.end_date IS NULL OR ps.end_date > NOW())
            ORDER BY ps.start_date DESC
            LIMIT 1),
           (SELECT spt.id FROM system_property_type spt WHERE spt.external_mapping_id = 'AIR_MAINCARRIAGE'),
           '3.5'
       );

INSERT INTO system_property (property_set_id, system_property_type_id, property_value)
VALUES (
           (SELECT ps.id FROM `property_set` ps
            WHERE ps.state = 'VALID'
              AND ps.start_date <= NOW()
              AND (ps.end_date IS NULL OR ps.end_date > NOW())
            ORDER BY ps.start_date DESC
            LIMIT 1),
           (SELECT spt.id FROM system_property_type spt WHERE spt.external_mapping_id = 'AIR_HANDOVER_FEE'),
           '35'
       );

INSERT INTO system_property (property_set_id, system_property_type_id, property_value)
VALUES (
           (SELECT ps.id FROM `property_set` ps
            WHERE ps.state = 'VALID'
              AND ps.start_date <= NOW()
              AND (ps.end_date IS NULL OR ps.end_date > NOW())
            ORDER BY ps.start_date DESC
            LIMIT 1),
           (SELECT spt.id FROM system_property_type spt WHERE spt.external_mapping_id = 'AIR_CUSTOM_FEE'),
           '45'
       );

INSERT INTO system_property (property_set_id, system_property_type_id, property_value)
VALUES (
           (SELECT ps.id FROM `property_set` ps
            WHERE ps.state = 'VALID'
              AND ps.start_date <= NOW()
              AND (ps.end_date IS NULL OR ps.end_date > NOW())
            ORDER BY ps.start_date DESC
            LIMIT 1),
           (SELECT spt.id FROM system_property_type spt WHERE spt.external_mapping_id = 'AIR_ONCARRIAGE'),
           '0.2'
       );

INSERT INTO system_property (property_set_id, system_property_type_id, property_value)
VALUES (
           (SELECT ps.id FROM `property_set` ps
            WHERE ps.state = 'VALID'
              AND ps.start_date <= NOW()
              AND (ps.end_date IS NULL OR ps.end_date > NOW())
            ORDER BY ps.start_date DESC
            LIMIT 1),
           (SELECT spt.id FROM system_property_type spt WHERE spt.external_mapping_id = 'AIR_TERMINAL_FEE'),
           '0.2'
       );

INSERT INTO system_property (property_set_id, system_property_type_id, property_value)
VALUES (
           (SELECT ps.id FROM `property_set` ps
            WHERE ps.state = 'VALID'
              AND ps.start_date <= NOW()
              AND (ps.end_date IS NULL OR ps.end_date > NOW())
            ORDER BY ps.start_date DESC
            LIMIT 1),
           (SELECT spt.id FROM system_property_type spt WHERE spt.external_mapping_id = 'KLT_HANDLING'),
           '0.71'
       );

INSERT INTO system_property (property_set_id, system_property_type_id, property_value)
VALUES (
           (SELECT ps.id FROM `property_set` ps
            WHERE ps.state = 'VALID'
              AND ps.start_date <= NOW()
              AND (ps.end_date IS NULL OR ps.end_date > NOW())
            ORDER BY ps.start_date DESC
            LIMIT 1),
           (SELECT spt.id FROM system_property_type spt WHERE spt.external_mapping_id = 'GLT_HANDLING'),
           '3.5'
       );

INSERT INTO system_property (property_set_id, system_property_type_id, property_value)
VALUES (
           (SELECT ps.id FROM `property_set` ps
            WHERE ps.state = 'VALID'
              AND ps.start_date <= NOW()
              AND (ps.end_date IS NULL OR ps.end_date > NOW())
            ORDER BY ps.start_date DESC
            LIMIT 1),
           (SELECT spt.id FROM system_property_type spt WHERE spt.external_mapping_id = 'BOOKING'),
           '3.5'
       );

INSERT INTO system_property (property_set_id, system_property_type_id, property_value)
VALUES (
           (SELECT ps.id FROM `property_set` ps
            WHERE ps.state = 'VALID'
              AND ps.start_date <= NOW()
              AND (ps.end_date IS NULL OR ps.end_date > NOW())
            ORDER BY ps.start_date DESC
            LIMIT 1),
           (SELECT spt.id FROM system_property_type spt WHERE spt.external_mapping_id = 'BOOKING_KLT'),
           '0.35'
       );


INSERT INTO system_property (property_set_id, system_property_type_id, property_value)
VALUES (
           (SELECT ps.id FROM `property_set` ps
            WHERE ps.state = 'VALID'
              AND ps.start_date <= NOW()
              AND (ps.end_date IS NULL OR ps.end_date > NOW())
            ORDER BY ps.start_date DESC
            LIMIT 1),
           (SELECT spt.id FROM system_property_type spt WHERE spt.external_mapping_id = 'GLT_RELEASE'),
           '2.23'
       );

INSERT INTO system_property (property_set_id, system_property_type_id, property_value)
VALUES (
           (SELECT ps.id FROM `property_set` ps
            WHERE ps.state = 'VALID'
              AND ps.start_date <= NOW()
              AND (ps.end_date IS NULL OR ps.end_date > NOW())
            ORDER BY ps.start_date DESC
            LIMIT 1),
           (SELECT spt.id FROM system_property_type spt WHERE spt.external_mapping_id = 'KLT_RELEASE'),
           '1.12'
       );

INSERT INTO system_property (property_set_id, system_property_type_id, property_value)
VALUES (
           (SELECT ps.id FROM `property_set` ps
            WHERE ps.state = 'VALID'
              AND ps.start_date <= NOW()
              AND (ps.end_date IS NULL OR ps.end_date > NOW())
            ORDER BY ps.start_date DESC
            LIMIT 1),
           (SELECT spt.id FROM system_property_type spt WHERE spt.external_mapping_id = 'GLT_DISPATCH'),
           '1.61'
       );

INSERT INTO system_property (property_set_id, system_property_type_id, property_value)
VALUES (
           (SELECT ps.id FROM `property_set` ps
            WHERE ps.state = 'VALID'
              AND ps.start_date <= NOW()
              AND (ps.end_date IS NULL OR ps.end_date > NOW())
            ORDER BY ps.start_date DESC
            LIMIT 1),
           (SELECT spt.id FROM system_property_type spt WHERE spt.external_mapping_id = 'KLT_DISPATCH'),
           '0.333'
       );

INSERT INTO system_property (property_set_id, system_property_type_id, property_value)
VALUES (
           (SELECT ps.id FROM `property_set` ps
            WHERE ps.state = 'VALID'
              AND ps.start_date <= NOW()
              AND (ps.end_date IS NULL OR ps.end_date > NOW())
            ORDER BY ps.start_date DESC
            LIMIT 1),
           (SELECT spt.id FROM system_property_type spt WHERE spt.external_mapping_id = 'KLT_REPACK_S'),
           '2.08'
       );

INSERT INTO system_property (property_set_id, system_property_type_id, property_value)
VALUES (
           (SELECT ps.id FROM `property_set` ps
            WHERE ps.state = 'VALID'
              AND ps.start_date <= NOW()
              AND (ps.end_date IS NULL OR ps.end_date > NOW())
            ORDER BY ps.start_date DESC
            LIMIT 1),
           (SELECT spt.id FROM system_property_type spt WHERE spt.external_mapping_id = 'KLT_REPACK_M'),
           '3.02'
       );

INSERT INTO system_property (property_set_id, system_property_type_id, property_value)
VALUES (
           (SELECT ps.id FROM `property_set` ps
            WHERE ps.state = 'VALID'
              AND ps.start_date <= NOW()
              AND (ps.end_date IS NULL OR ps.end_date > NOW())
            ORDER BY ps.start_date DESC
            LIMIT 1),
           (SELECT spt.id FROM system_property_type spt WHERE spt.external_mapping_id = 'GLT_REPACK_S'),
           '3.02'
       );

INSERT INTO system_property (property_set_id, system_property_type_id, property_value)
VALUES (
           (SELECT ps.id FROM `property_set` ps
            WHERE ps.state = 'VALID'
              AND ps.start_date <= NOW()
              AND (ps.end_date IS NULL OR ps.end_date > NOW())
            ORDER BY ps.start_date DESC
            LIMIT 1),
           (SELECT spt.id FROM system_property_type spt WHERE spt.external_mapping_id = 'GLT_REPACK_M'),
           '7.76'
       );

INSERT INTO system_property (property_set_id, system_property_type_id, property_value)
VALUES (
           (SELECT ps.id FROM `property_set` ps
            WHERE ps.state = 'VALID'
              AND ps.start_date <= NOW()
              AND (ps.end_date IS NULL OR ps.end_date > NOW())
            ORDER BY ps.start_date DESC
            LIMIT 1),
           (SELECT spt.id FROM system_property_type spt WHERE spt.external_mapping_id = 'GLT_REPACK_L'),
           '14'
       );

INSERT INTO system_property (property_set_id, system_property_type_id, property_value)
VALUES (
           (SELECT ps.id FROM `property_set` ps
            WHERE ps.state = 'VALID'
              AND ps.start_date <= NOW()
              AND (ps.end_date IS NULL OR ps.end_date > NOW())
            ORDER BY ps.start_date DESC
            LIMIT 1),
           (SELECT spt.id FROM system_property_type spt WHERE spt.external_mapping_id = 'DISPOSAL'),
           '6'
       );

INSERT INTO system_property (property_set_id, system_property_type_id, property_value)
VALUES (
           (SELECT ps.id FROM `property_set` ps
            WHERE ps.state = 'VALID'
              AND ps.start_date <= NOW()
              AND (ps.end_date IS NULL OR ps.end_date > NOW())
            ORDER BY ps.start_date DESC
            LIMIT 1),
           (SELECT spt.id FROM system_property_type spt WHERE spt.external_mapping_id = 'SPACE_COST'),
           '0.2630136986'
       );