<?php
function convert_property_type($in)
{
	$values = ['House', 'Bungalow', 'Flat', 'Maisonette', 'Park home'];
	$out = $values[$in];
	return $out;
}

function convert_built_form($in)
{
	$values = [1 => 'Detached', 2 => 'Semi-detached', 3 => 'End-terrace', 4 => 'Mid-terrace', 5 => 'Enclosed end-terrace', 6 => 'Enclosed mid-terrace'];
	$out = $values[$in];
	return $out;
}

function convert_data_type($in)
{
	$values = [1 => 'As designed', 2 => 'As built'];
	$out = $values[$in];
	return $out;
}

function convert_fuel_code($in)
{
	$values = [1 => 'Mains gas', 2 => 'Bulk LPG', 3 => 'Bottled LPG', 4 => 'Heating oil', 5 => 'Bottled LPG', 7 => 'Biogas (including anaerobic digestion)  ', 9 => 'LPG subject to Special Condition 11F', 10 => 'Dual fuel appliance (mineral and wood)', 11 => 'House coal', 12 => 'Manufactured smokeless fuel', 15 => 'Anthracite', 20 => 'Wood logs', 21 => 'Wood chips', 22 => 'Wood pellets (in bags)', 23 => 'Wood pellets (bulk supply)', 30 => 'Electricity', 31 => 'Electricity', 32 => 'Electricity', 33 => 'Electricity', 34 => 'Electricity', 35 => 'Electricity', 36 => 'Electricity', 38 => 'Electricity', 39 => 'Electricity', 40 => 'Electricity', 41 => 'Heat network', 42 => 'Heat network', 43 => 'Heat network', 44 => 'Heat network', 45 => 'Heat network', 46 => 'Heat network', 48 => 'Heat network', 49 => 'Heat network', 50 => 'Heat network', 51 => 'Heat network', 52 => 'Heat network', 53 => 'Heat network', 54 => 'Heat network', 55 => 'Heat network', 56 => 'Heat network', 57 => 'Heat network', 58 => 'Heat network', 60 => 'Electricity', 71 => 'Bio-liquid HVO from used cooking oil', 73 => 'Bio-liquid FAME from animal/vegetable oils', 75 => 'B30K', 76 => 'Bioethanol from any biomass source', 99 => 'Fuel from PCDB'];
	$out = $values[$in];
	return $out;
}

function convert_opening_type_code($in)
{
	$values = [1 => 'Solid door', 2 => 'Semi-glazed door', 3 => 'Door to corridor', 4 => 'Window', 5 => 'Roof window', 6 => 'Rooflight'];
	$out = $values[$in];
	return $out;
}

function convert_wall_type_code($in)
{
	$values = [1 => 'Basement wall', 2 => 'Exposed wall', 3 => 'Sheltered wall', 4 => 'Party wall', 5 => 'Internal wall'];
	$out = $values[$in];
	return $out;
}

function convert_roof_type_code($in)
{
	$values = [2 => 'Exposed roof', 4 => 'Party ceiling'];
	$out = $values[$in];
	return $out;
}

function convert_floor_type_code($in)
{
	$values = [1 => 'Basement floor', 2 => 'Ground floor', 3 => 'Upper floor', 4 => 'Party floor'];
	$out = $values[$in];
	return $out;
}

function convert_orientation_code($in)
{
	$values = [0 => 'N/A', 1 => 'North', 2 => 'North East', 3 => 'East', 4 => 'South East', 5 => 'South', 6 => 'South West', 7 => 'West', 8 => 'North West', 9 => 'Horizontal', 'ND' => 'Horizontal'];
	$out = $values[$in];
	return $out;
}

function convert_thermal_bridging_code($in)
{
	$values = [1 => 'Default y-value', 5 => 'User defined individual values'];
	$out = $values[$in];
	return $out;
}

function convert_thermal_bridge_code($in)
{
	$values = ['E1' => 'E1: Steel lintel with perforated steel base plate', 'E2' => 'E2: Other lintels (including other steel lintels)', 'E3' => 'E3: Sill', 'E4' => 'E4: Jamb', 'E5' => 'E5: Ground floor (normal)', 'E6' => 'E6: Intermediate floor within a dwelling', 'E7' => 'E7: Party floor between dwellings (in blocks of flats)', 'E8' => 'E8: Balcony within a dwelling - wall insulation continuous', 'E9' => 'E9: Balcony between dwellings - wall insulation continuous', 'E10' => 'E10: Eaves (insulation at ceiling level)', 'E11' => 'E11: Eaves (insulation at rafter level)', 'E12' => 'E12: Gable (insulation at ceiling level)', 'E13' => 'E13: Gable (insulation at rafter level)', 'E14' => 'E14: Flat roof', 'E15' => 'E15: Flat roof with parapet', 'E16' => 'E16: Corner (normal)', 'E17' => 'E17: Corner (inverted - internal area greater than external area)', 'E18' => 'E18: Party wall between dwellings', 'E19' => 'E19: Ground floor (inverted)', 'E20' => 'E20: Exposed floor (normal)', 'E21' => 'E21: Exposed floor (inverted)', 'E22' => 'E22: Basement floor', 'E23' => 'E23: Balcony within or between dwellings - balcony support penetrates wall insulation', 'E24' => 'E24: Eaves (insulation at ceiling level - inverted)', 'E25' => 'E25: Staggered party wall between dwellings', 'P1' => 'P1: Ground floor', 'P2' => 'P2: Intermediate floor within a dwelling', 'P3' => 'P3: Intermediate floor between dwellings (in blocks of flats)', 'P4' => 'P4: Roof (insulation at ceiling level)', 'P5' => 'P5: Roof (insulation at rafter level)', 'P6' => 'P6: Ground floor (inverted)', 'P7' => 'P7: Exposed floor (normal)', 'P8' => 'P8: Exposed floor (inverted)', 'R1' => 'R1: Head of roof window', 'R2' => 'R2: Sill of roof window', 'R3' => 'R3: Jamb of roof window', 'R4' => 'R4: Ridge (vaulted ceiling)', 'R5' => 'R5: Ridge (inverted)', 'R6' => 'R6: Flat ceiling', 'R7' => 'R7: Flat ceiling (inverted)', 'R8' => 'R8: Roof to wall (rafter)', 'R9' => 'R9: Roof to wall (flat ceiling)', 'R10' => 'R10: All other roof or room-in-roof junctions', 'R11' => 'R11: Upstands or kerbs of rooflights', 'O1' => 'O1: Other type 1', 'O2' => 'O2: Other type 2'];
	$out = $values[$in];
	return $out;
}

function obtain_thermal_bridge_location($in)
{
	switch ($in) {
	case 'E1':
	case 'E2':
	case 'E3':
	case 'E4':
	case 'E5':
	case 'E6':
	case 'E7':
	case 'E8':
	case 'E9':
	case 'E10':
	case 'E11':
	case 'E12':
	case 'E13':
	case 'E14':
	case 'E15':
	case 'E16':
	case 'E17':
	case 'E18':
	case 'E19':
	case 'E20':
	case 'E21':
	case 'E22':
	case 'E23':
	case 'E24':
	case 'E25':
		$out = 'External wall';
		break;
	case 'P1':
	case 'P2':
	case 'P3':
	case 'P4':
	case 'P5':
	case 'P6':
	case 'P7':
	case 'P8':
		$out = 'Party wall';
		break;
	case 'R1':
	case 'R2':
	case 'R3':
	case 'R4':
	case 'R5':
	case 'R6':
	case 'R7':
	case 'R8':
	case 'R9':
	case 'R10':
	case 'R11':
		$out = 'Roof';
		break;
	case 'O1':
	case 'O2':
		$out = 'Other location';
		break;
	}

	return $out;
}

function convert_psi_source_code($in)
{
	$values = [1 => 'Calculated by person with suitable expertise', 2 => 'Government-approved scheme', 3 => 'Not government-approved scheme', 4 => 'SAP table default'];
	$out = $values[$in];
	return $out;
}

function convert_pressure_test_code($in)
{
	$values = [1 => 'Measured value', 2 => 'Design value', 3 => 'Assumed value', 5 => 'SAP-calculated value', 7 => 'Measured value - low-pressure pulse'];
	$out = $values[$in];
	return $out;
}

function convert_main_heating_category_code($in)
{
	$values = [1 => 'None - direct acting electric heaters assumed', 2 => 'Boiler with radiators or underfloor heating', 3 => 'Micro-cogeneration', 4 => 'Heat pump with radiators or underfloor heating', 5 => 'Heat pump with warm air distribution', 6 => 'Heat network', 7 => 'Electric storage heaters', 8 => 'Electric underfloor heating', 9 => 'Warm air system (not heat pump)', 10 => 'Room heaters', 11 => 'Other system'];
	$out = $values[$in];
	return $out;
}

function convert_heat_emitter_code($in)
{
	$values = [1 => 'Radiators', 2 => 'Underfloor', 3 => 'Both radiators and underfloor', 4 => 'Fan coil units'];
	$out = $values[$in];
	return $out;
}

function convert_main_heating_code($in)
{
	$values = [101 => 'Regular non-condensing with automatic ignition', 102 => 'Regular condensing with automatic ignition', 103 => 'Non-condensing combi with automatic ignition', 104 => 'Condensing combi with automatic ignition', 105 => 'Regular non-condensing with permanent pilot light', 106 => 'Regular condensing with permanent pilot light', 107 => 'Non-condensing combi with permanent pilot light', 108 => 'Condensing combi with permanent pilot light', 109 => 'Back boiler to radiators', 110 => 'Regular, low thermal capacity', 111 => 'Regular, high or unknown thermal capacity', 112 => 'Combi', 113 => 'Condensing combi', 114 => 'Regular, condensing', 115 => 'Regular, wall mounted', 116 => 'Regular, floor mounted, pre 1979', 117 => 'Regular, floor mounted, 1979 to 1997', 118 => 'Combi', 119 => 'Back boiler to radiators', 120 => 'CPSU with automatic ignition (non-condensing)', 121 => 'CPSU with automatic ignition (condensing)', 122 => 'CPSU with permanent pilot (non-condensing)', 123 => 'CPSU with permanent pilot (condensing)', 124 => 'Standard oil boiler pre-1985', 125 => 'Standard oil boiler 1985 to 1997', 126 => 'Standard oil boiler, 1998 or later', 127 => 'Condensing', 128 => 'Combi, pre-1998', 129 => 'Combi, 1998 or later', 130 => 'Condensing combi', 131 => 'Oil room heater with boiler to radiators, pre 2000', 132 => 'Oil room heater with boiler to radiators, 2000 or later', 133 => 'Range cooker, single burner with permanent pilot', 134 => 'Range cooker, single burner with automatic ignition', 135 => 'Range cooker, twin burner with permanent pilot (non-condensing) pre 1998', 136 => 'Range cooker, twin burner with automatic ignition (non-condensing) pre 1998', 137 => 'Range cooker, twin burner with permanent pilot (non-condensing) 1998 or later', 138 => 'Range cooker, twin burner with automatic ignition (non-condensing) 1998 or later', 139 => 'Range cooker, single burner', 140 => 'Range cooker, twin burner (non-condensing) pre 1998', 141 => 'Range cooker, twin burner (non-condensing) 1998 or later', 151 => 'Manual feed independent boiler', 153 => 'Auto (gravity) feed independent boiler', 155 => 'Wood chip/pellet independent boiler', 156 => 'Open fire with back boiler to radiators', 158 => 'Closed room heater with boiler to radiators', 159 => 'Stove (pellet-fired) with boiler to radiators', 160 => 'Range cooker boiler (integral oven and boiler)', 161 => 'Range cooker boiler (independent oven and boiler)', 191 => 'Direct acting electric boiler', 192 => 'Electric CPSU', 193 => 'Electric dry core storage boiler', 194 => 'Electric dry core storage boiler', 195 => 'Electric water storage boiler', 196 => 'Electric water storage boiler', 211 => 'Ground source heat pump', 213 => 'Water source heat pump', 214 => 'Air source heat pump', 215 => 'Ground source heat pump', 216 => 'Water source heat pump', 217 => 'Air source heat pump', 221 => 'Ground source heat pump', 223 => 'Water source heat pump', 224 => 'Air source heat pump', 225 => 'Ground source heat pump', 226 => 'Water source heat pump', 227 => 'Air source heat pump', 401 => 'Old (large volume) storage heaters', 402 => 'Slimline storage heaters', 403 => 'Convector storage heaters', 404 => 'Fan storage heaters', 405 => 'Slimline storage heaters with Celect-type control', 406 => 'Convector storage heaters with Celect-type control', 407 => 'Fan storage heaters with Celect-type control', 408 => 'Integrated storage+direct-acting heater', 409 => 'High heat retention storage heaters', 421 => 'In concrete slab (off-peak only)', 422 => 'Integrated (storage+direct-acting)', 423 => 'Integrated (storage+direct-acting) with low (off-peak) tariff control', 424 => 'In screed above insulation', 425 => 'In timber floor, or immediately below floor covering', 501 => 'Ducted, on-off control, pre 1998', 502 => 'Ducted, on-off control, 1998 or later', 503 => 'Ducted, modulating control, pre 1998', 504 => 'Ducted, modulating control, 1998 or later', 505 => 'Room heater with in-floor ducts', 506 => 'Ducted or stub-ducted, on-off control, pre 1998', 507 => 'Ducted or stub-ducted, on-off control, 1998 or later', 508 => 'Ducted or stub-ducted, modulating control, pre 1998', 509 => 'Ducted or stub-ducted, modulating control, 1998 or later', 510 => 'Ducted or stub-ducted with flue heat recovery', 511 => 'Condensing', 512 => 'Ducted output (on/off control)', 513 => 'Ducted output (modulating control)', 514 => 'Stub duct system', 515 => 'Electricaire system', 520 => 'Condensing', 521 => 'Ground source heat pump', 523 => 'Water source heat pump', 524 => 'Air source heat pump', 525 => 'Ground source heat pump', 526 => 'Water source heat pump', 527 => 'Air source heat pump', 601 => 'Gas fire, open flue, pre-1980 (open fronted)', 602 => 'Gas fire, open flue, pre-1980 (open fronted), with back boiler unit', 603 => 'Gas fire, open flue, 1980 or later (open fronted)', 604 => 'Gas fire, open flue, 1980 or later (open fronted), with back boiler unit', 605 => 'Flush fitting Live Fuel Effect gas fire (open fronted)', 606 => 'Flush fitting Live Fuel Effect gas fire (open fronted), with back boiler unit', 607 => 'Flush fitting Live Fuel Effect gas fire (open fronted), fan assisted', 609 => 'Gas fire or wall heater, balanced flue', 610 => 'Gas fire, closed fronted, fan assisted', 611 => 'Condensing gas fire', 612 => 'Decorative Fuel Effect gas fire, open to chimney', 613 => 'Flueless gas fire', 621 => 'Room heater, pre 2000', 622 => 'Room heater, pre 2000, with boiler (no radiators)', 623 => 'Room heater, 2000 or later', 624 => 'Room heater, 2000 or later with boiler (no radiators)', 625 => 'Bioethanol heater', 631 => 'Open fire in grate', 632 => 'Open fire with back boiler (no radiators)', 633 => 'Closed room heater', 634 => 'Closed room heater with boiler (no radiators)', 635 => 'Stove (pellet fired)', 636 => 'Stove (pellet fired) with boiler (no radiators)', 691 => 'Panel, convector or radiant heaters', 692 => 'Fan heaters', 693 => 'Portable electric heaters', 694 => 'Water- or oil-filled radiators', 699 => 'Electric heaters (assumed)', 701 => 'Electric ceiling heating'];
	$out = $values[$in];
	return $out;
}

function convert_secondary_heating_category_code($in)
{
	$values = [1 => 'None', 10 => 'Room heaters'];
	$out = $values[$in];
	return $out;
}

function convert_water_heating_code($in)
{
	$values = [901 => 'From main heating system', 902 => 'From secondary system', 903 => 'Electric immersion', 907 => 'Single-point gas water heater (instantaneous at point of use)', 908 => 'Multi-point gas water heater (instantaneous serving several taps)', 909 => 'Electric instantaneous at point of use', 911 => 'Gas boiler/circulator for water heating only', 912 => 'Oil boiler/circulator for water heating only', 913 => 'Solid fuel boiler/circulator for water heating only', 914 => 'From second main heating system', 921 => 'Range cooker with boiler for water heating only, single burner with permanent pilot', 922 => 'Range cooker with boiler for water heating only, single burner with automatic ignition', 923 => 'Range cooker with boiler for water heating only, twin burner with permanent pilot pre 1998', 924 => 'Range cooker with boiler for water heating only, twin burner with automatic ignition  pre 1998', 925 => 'Range cooker with boiler for water heating only, twin burner with permanent pilot 1998 or later', 926 => 'Range cooker with boiler for water heating only, twin burner with automatic ignition 1998 or later', 927 => 'Range cooker with boiler for water heating only, single burner', 928 => 'Range cooker with boiler for water heating only, twin burner pre 1998', 929 => 'Range cooker with boiler for water heating only, twin burner 1998 or later', 930 => 'Range cooker with boiler for water heating only, integral oven and boiler', 931 => 'Range cooker with boiler for water heating only, independent oven and boiler', 941 => 'Electric heat pump for water heating only', 950 => 'Hot-water only heat network', 951 => 'Hot-water only heat network', 952 => 'Hot-water only heat network', 953 => 'Hot-water only heat network', 999 => 'No hot water system present - electric immersion assumed'];
	$out = $values[$in];
	return $out;
}

function convert_pipework_insulation($in)
{
	$values = [1 => 'No', 2 => 'Yes', 3 => 'Yes', 4 => 'Yes'];
	$out = $values[$in];
	return $out;
}

function convert_thermal_store($in)
{
	$values = [1 => 'N/A', 2 => 'Hot water only thermal store', 3 => 'Integrated thermal store'];
	$out = $values[$in];
	return $out;
}

function convert_heating_control_code($in)
{
	$values = [2100 => 'Not applicable ', 2101 => 'No time or thermostatic control of room temperature', 2102 => 'Programmer, no room thermostat', 2103 => 'Room thermostat only', 2104 => 'Programmer and room thermostat', 2105 => 'Programmer and at least two room thermostats', 2106 => 'Programmer, room thermostat, and TRVs', 2107 => 'Programmer, TRVs, and bypass', 2108 => 'Programmer, TRVs, and flow switch', 2109 => 'Programmer, TRVs, and boiler energy manager', 2110 => 'Time and temperature zone control by arrangement of plumbing and electrical services', 2111 => 'TRVs and bypass', 2112 => 'Time and temperature zone control by device in PCDB', 2113 => 'Room thermostat and TRVs', 2201 => 'No time or thermostatic control of room temperature', 2202 => 'Programmer, no room thermostat', 2203 => 'Room thermostat only', 2204 => 'Programmer and room thermostat', 2205 => 'Programmer and at least two room thermostats', 2206 => 'Programmer, TRVs, and bypass', 2207 => 'Time and temperature zone control by arrangement of plumbing and electrical services', 2208 => 'Time and temperature zone control by device in PCDB', 2209 => 'Room thermostat and TRVs', 2210 => 'Programmer, room thermostat and TRVs', 2301 => 'Flat rate charging, no thermostatic control of room temperature', 2302 => 'Flat rate charging, programmer, no room thermostat', 2303 => 'Flat rate charging, room thermostat only', 2304 => 'Flat rate charging, programmer, and room thermostat', 2305 => 'Flat rate charging, programmer, and TRVs', 2306 => 'Charging system linked to use of heating, programmer, and TRVs', 2307 => 'Flat rate charging, TRVs', 2308 => 'Charging system linked to use of heating, room thermostat only', 2309 => 'Charging system linked to use of heating, programmer and room thermostat', 2310 => 'Charging system linked to use of heating, TRVs', 2311 => 'Flat rate charging, programmer and at least two room thermostats', 2312 => 'Charging system linked to use of heating, programmer, and at least two room thermostats', 2313 => 'Flat rate charging, room thermostat, and TRVs', 2314 => 'Charging system linked to use of heating, room thermostat, and TRVs', 2401 => 'Manual charge control', 2402 => 'Automatic charge control', 2403 => 'Celect-type controls', 2404 => 'Controls for high heat retention storage heaters', 2501 => 'No time or thermostatic control of room temperature', 2502 => 'Programmer, no room thermostat', 2503 => 'Room thermostat only', 2504 => 'Programmer and room thermostat', 2505 => 'Programmer and at least two room thermostats', 2506 => 'Time and temperature zone control', 2601 => 'No thermostatic control of room temperature', 2602 => 'Appliance thermostats', 2603 => 'Programmer and appliance thermostats', 2604 => 'Room thermostats only', 2605 => 'Programmer and room thermostats', 2699 => 'None', 2701 => 'No time or thermostatic control of room temperature', 2702 => 'Programmer, no room thermostat', 2703 => 'Room thermostat only', 2704 => 'Programmer and room thermostat', 2705 => 'Temperature zone control', 2706 => 'Time and temperature zone control'];
	$out = $values[$in];
	return $out;
}

function convert_ventilation_type_code($in)
{
	$values = [1 => 'N/A', 2 => 'N/A', 3 => 'N/A', 4 => 'Positive input from outside', 5 => 'Centralised mechanical extract', 6 => 'Decentralised mechanical extract', 7 => 'Balanced whole-house mechanical ventilation without heat recovery', 8 => 'Balanced whole-house mechanical ventilation with heat recovery', 9 => 'N/A', 10 => 'N/A'];
	$out = $values[$in];
	return $out;
}

function convert_collector_type($in)
{
	$values = [1 => 'Unglazed', 2 => 'Glazed flat plate', 3 => 'Evacuated tube'];
	$out = $values[$in];
	return $out;
}

function convert_pitch_code($in)
{
	$values = [1 => 'Horizontal', 2 => '30&deg;', 3 => '45&deg;', 4 => '60&deg;', 5 => 'Vertical'];
	$out = $values[$in];
	return $out;
}

function convert_overshading_code($in)
{
	$values = [1 => 'None or very little', 2 => 'Modest', 3 => 'Significant', 4 => 'Heavy'];
	$out = $values[$in];
	return $out;
}

function convert_service_provision_code($in)
{
	$values = [1 => 'Space and water heating', 2 => 'Space heating only', 3 => 'Water heating only'];
	$out = $values[$in];
	return $out;
}

function convert_pv_connection_code($in)
{
	$values = [1 => 'N/A (FGHRS)', 2 => 'Not connected to dwelling\'s electricity meter', 3 => 'Connected to dwelling\'s electricity meter'];
	$out = $values[$in];
	return $out;
}

function convert_heat_network_use_code($in)
{
	$values = [1 => 'Space heating only', 2 => 'Water heating only', 3 => 'Space and water heating'];
	$out = $values[$in];
	return $out;
}

function convert_heat_network_status_code($in)
{
	$values = ['true' => 'Existing heat network', 'false' => 'New heat network'];
	$out = $values[$in];
	return $out;
}

function convert_boolean($in)
{
	$values = ['true' => 'Yes', 'false' => 'No'];
	$out = $values[$in];
	return $out;
}

?>