<?xml version="1.0" encoding="UTF-8" ?>

<!-- Copyright (c) 2021 Josh Davidson (Octal450) -->

<!-- A3XX Aircraft Config Dialog -->

<PropertyList>

    <name>ground-services</name>
    <layout>vbox</layout>

    <group>
        <layout>hbox</layout>
        <text>
            <halign>left</halign>
            <label>Ground Services</label>
        </text>
        <button>
            <halign>right</halign>
            <pref-width>20</pref-width>
            <pref-height>20</pref-height>
            <legend>X</legend>
            <key>Esc</key>
            <binding>
                <command>dialog-close</command>
            </binding>
        </button>
    </group>

    <hrule/>

    <group>
        <layout>vbox</layout>

        <group>
            <layout>hbox</layout>
            <hrule>
                <stretch type="bool">true</stretch>
            </hrule>
            <text>
                <label>Landing Gear</label>
            </text>
            <hrule>
                <stretch type="bool">true</stretch>
            </hrule>
        </group>

        <group>
            <layout>vbox</layout>
            <checkbox>
                <label>Enable Gear Chocks</label>
                <halign>left</halign>
                <enable>
                    <and>
                        <property>/gear/gear[0]/wow</property>
                        <property>/gear/gear[1]/wow</property>
                        <property>/gear/gear[2]/wow</property>
                    </and>
                </enable>
                <property>/services/chocks/enable</property>
                <binding>
                    <command>dialog-apply</command>
                </binding>
                <live>true</live>
            </checkbox>
        </group>
    </group>

    <group>
        <layout>vbox</layout>

        <group>
            <layout>hbox</layout>
            <hrule>
                <stretch type="bool">true</stretch>
            </hrule>
            <text>
                <label>APU / EPU / AIR / HYD</label>
            </text>
            <hrule>
                <stretch type="bool">true</stretch>
            </hrule>
        </group>

        <text>
            <label>APU Oil Level</label>
        </text>

        <group>
            <layout>hbox</layout>
            <slider>
                <enable>
                    <property>/systems/apu/oil/allow-oil-consumption</property>
                </enable>
                <x>10</x>
                <y>50</y>
                <width>200</width>
                <property>/systems/apu/oil/level-l</property>
                <min>3.9</min>
                <max>5.4</max>
                <live>true</live>
                <binding>
                    <command>dialog-apply</command>
                </binding>
            </slider>

            <text>
                <x>10</x>
                <y>200</y>
                <label>8.8 litres</label><!-- placeholder for width -->
                <format>%.1f litres</format>
                <property>/systems/apu/oil/level-l</property>
                <live>true</live>
            </text>
        </group>

        <checkbox>
            <label>Enable External Power Box</label>
            <halign>left</halign>
            <property>/controls/electrical/switches/ground-cart</property>
            <binding>
                <command>property-assign</command>
                <property>/controls/electrical/switches/ext-pwr</property>
                <value>0</value>
            </binding>
            <enable>
				<less-than>
					<property>/velocities/groundspeed-kt</property>
					<value>2</value>
				</less-than>
            </enable>
            <binding>
                <command>dialog-apply</command>
            </binding>
            <live>true</live>
        </checkbox>

        <checkbox>
            <label>Enable External Air</label>
            <halign>left</halign>
            <property>/controls/pneumatics/switches/ground-air</property>
            <binding>
                <command>property-toggle</command>
                <property>/controls/pneumatics/switches/ground-air</property>
            </binding>
            <enable>
				<less-than>
					<property>/velocities/groundspeed-kt</property>
					<value>2</value>
				</less-than>
            </enable>
            <binding>
                <command>dialog-apply</command>
            </binding>
            <live>true</live>
        </checkbox>
    </group>

    <group>
        <layout>vbox</layout>

        <group>
            <layout>hbox</layout>
            <hrule>
                <stretch type="bool">true</stretch>
            </hrule>
            <text>
                <label>Stairways</label>
            </text>
            <hrule>
                <stretch type="bool">true</stretch>
            </hrule>
        </group>

		<group>
            <layout>hbox</layout>
			<checkbox>
				<label>Front Left</label>
				<halign>left</halign>
				<property>/services/stairs/l1</property>
				<binding>
					<command>dialog-apply</command>
				</binding>
				<live>true</live>
			</checkbox>

			<checkbox>
				<label>Rear Left</label>
				<halign>left</halign>
				<property>/services/stairs/l4</property>
				<binding>
					<command>dialog-apply</command>
				</binding>
				<live>true</live>
			</checkbox>
		</group>

        <checkbox>
            <label>Stairway Cover</label>
            <halign>left</halign>
            <property>/services/stairs/cover</property>
            <binding>
                <command>dialog-apply</command>
            </binding>
            <live>true</live>
        </checkbox>

        <group>
            <layout>hbox</layout>
            <hrule>
                <stretch type="bool">true</stretch>
            </hrule>
            <text>
                <label>Baggage</label>
            </text>
            <hrule>
                <stretch type="bool">true</stretch>
            </hrule>
        </group>

        <checkbox>
            <label>Enable Baggage Ramp</label>
            <halign>left</halign>
            <property>/services/baggage/enable</property>
            <binding>
                <command>dialog-apply</command>
            </binding>
            <live>true</live>
        </checkbox>

        <group>
            <layout>hbox</layout>
            <hrule>
                <stretch type="bool">true</stretch>
            </hrule>
            <text>
                <label>Catering</label>
            </text>
            <hrule>
                <stretch type="bool">true</stretch>
            </hrule>
        </group>

        <checkbox>
            <label>Enable Catering Truck</label>
            <halign>left</halign>
            <property>/services/catering/enable</property>
            <binding>
                <command>dialog-apply</command>
            </binding>
            <live>true</live>
        </checkbox>

        <button>
            <legend>Toggle Catering</legend>
            <halign>center</halign>
            <padding>5</padding>
            <enable>
                <property>/services/catering/enable</property>
            </enable>
            <binding>
                <condition>
                    <less-than>
                        <property>/services/catering/position-norm</property>
                        <value>0.1</value>
                    </less-than>
                </condition>
                <command>property-interpolate</command>
                <property>/services/catering/position-norm</property>
                <value>0.68</value>
                <time>5</time>
            </binding>
            <binding>
                <condition>
                    <greater-than-equals>
                        <property>/services/catering/position-norm</property>
                        <value>0.1</value>
                    </greater-than-equals>
                </condition>
                <command>property-interpolate</command>
                <property>/services/catering/position-norm</property>
                <value>0.0</value>
                <time>5</time>
            </binding>
        </button>

        <group>
            <layout>hbox</layout>
            <hrule>
                <stretch type="bool">true</stretch>
            </hrule>
            <text>
                <label>Fuel</label>
            </text>
            <hrule>
                <stretch type="bool">true</stretch>
            </hrule>
        </group>

        <button>
            <legend>Fuel Truck</legend>
            <halign>center</halign>
            <padding>5</padding>
            <binding>
                <command>nasal</command>
                <script>
                    acconfig.fuel_dlg.open();
                </script>
            </binding>
        </button>

        <group>
            <layout>hbox</layout>
            <hrule>
                <stretch type="bool">true</stretch>
            </hrule>
            <text>
                <label>De-icing</label>
            </text>
            <hrule>
                <stretch type="bool">true</stretch>
            </hrule>
        </group>

        <checkbox>
            <label>Enable De-icing Truck</label>
            <halign>left</halign>
            <property>/services/deicing_truck/enable</property>
            <binding>
                <command>dialog-apply</command>
            </binding>
            <live>true</live>
        </checkbox>

        <button>
            <legend>De-ice Aircraft</legend>
            <halign>center</halign>
            <padding>5</padding>
            <enable>
                <property>/services/deicing_truck/enable</property>
            </enable>
            <binding>
                <command>property-assign</command>
                <property>/services/deicing_truck/de-ice</property>
                <value>1</value>
            </binding>
        </button>

        <group>
            <layout>hbox</layout>
            <hrule>
                <stretch type="bool">true</stretch>
            </hrule>
            <text>
                <label>Oxygen</label>
            </text>
            <hrule>
                <stretch type="bool">true</stretch>
            </hrule>
        </group>
		
		<group>
			<layout>hbox</layout>
			<button>
				<legend>Replace Oxygen Bottle</legend>
				<halign>center</halign>
				<padding>5</padding>
				<enable>
					<property>/gear/gear[1]/wow</property>
				</enable>
				<binding>
					<command>property-assign</command>
					<property>/systems/oxygen/cockpit-oxygen/cockpit-bottle-L</property>
					<value>2183</value>
				</binding>
			</button>
			
			<text>
				<x>10</x>
				<y>200</y>
				<label>8888 litres</label><!-- placeholder for width -->
				<format>%4.0f litres</format>
				<property>/systems/oxygen/cockpit-oxygen/cockpit-bottle-L</property>
				<live>true</live>
			</text>
		</group>
		
        <button>
            <legend>Reset Pax Oxy Masks</legend>
            <halign>center</halign>
            <padding>5</padding>
			<enable>
				<property>/gear/gear[1]/wow</property>
			</enable>
            <binding>
                <command>property-assign</command>
                <property>/systems/oxygen/passenger-oxygen/masks-deploy</property>
                <value>0</value>
            </binding>
        </button>
		
        <button>
            <legend>Stow RAT</legend>
            <halign>center</halign>
            <padding>5</padding>
			<enable>
				<and>
					<property>/gear/gear[1]/wow</property>
					<less-than>
						<property>/velocities/groundspeed-kt</property>
						<value>100</value>
					</less-than>
				</and>
			</enable>
            <binding>
                <command>property-assign</command>
                <property>/systems/electrical/some-electric-thingie/rat-deploy</property>
                <value>0</value>
            </binding>
        </button>
    </group>

</PropertyList>