<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified"
           xmlns:xs="http://www.w3.org/2001/XMLSchema">

    <xs:complexType name="recordInfo">
        <xs:sequence>
            <xs:element name="rounds">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="turns">
                            <xs:complexType>
                                <xs:attribute name="value" type="xs:int" use="required"/>
                            </xs:complexType>
                        </xs:element>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="results">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element maxOccurs="unbounded" name="result">
                            <xs:complexType>
                                <xs:attribute name="teamLeaderName" type="xs:string" use="required"/>
                                <xs:attribute name="rank" type="xs:int" use="required"/>
                                <xs:attribute name="score" type="xs:decimal" use="required"/>
                                <xs:attribute name="survival" type="xs:decimal" use="required"/>
                                <xs:attribute name="lastSurvivorBonus" type="xs:decimal" use="required"/>
                                <xs:attribute name="bulletDamage" type="xs:decimal" use="required"/>
                                <xs:attribute name="bulletDamageBonus" type="xs:decimal" use="required"/>
                                <xs:attribute name="ramDamage" type="xs:decimal" use="required"/>
                                <xs:attribute name="ramDamageBonus" type="xs:decimal" use="required"/>
                                <xs:attribute name="firsts" type="xs:int" use="required"/>
                                <xs:attribute name="seconds" type="xs:int" use="required"/>
                                <xs:attribute name="thirds" type="xs:int" use="required"/>
                                <xs:attribute name="ver" type="xs:int" use="required"/>
                            </xs:complexType>
                        </xs:element>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
        </xs:sequence>
        <xs:attribute name="robotCount" type="xs:int" use="required"/>
        <xs:attribute name="roundsCount" type="xs:int" use="required"/>
        <xs:attribute name="ver" type="xs:int" use="required"/>
    </xs:complexType>

    <xs:complexType name="score">
        <xs:attribute name="name" type="xs:string" use="required"/>
        <xs:attribute name="totalScore" type="xs:decimal" use="required"/>
        <xs:attribute name="totalSurvivalScore" type="xs:decimal" use="required"/>
        <xs:attribute name="totalLastSurvivorBonus" type="xs:decimal" use="required"/>
        <xs:attribute name="totalBulletDamageScore" type="xs:decimal" use="required"/>
        <xs:attribute name="totalBulletKillBonus" type="xs:decimal" use="required"/>
        <xs:attribute name="totalRammingDamageScore" type="xs:decimal" use="required"/>
        <xs:attribute name="totalRammingKillBonus" type="xs:decimal" use="required"/>
        <xs:attribute name="totalFirsts" type="xs:int" use="required"/>
        <xs:attribute name="totalSeconds" type="xs:int" use="required"/>
        <xs:attribute name="totalThirds" type="xs:int" use="required"/>
        <xs:attribute name="currentScore" type="xs:decimal" use="required"/>
        <xs:attribute name="currentSurvivalScore" type="xs:decimal" use="required"/>
        <xs:attribute name="currentBulletDamageScore" type="xs:decimal" use="required"/>
        <xs:attribute name="currentBulletKillBonus" type="xs:decimal" use="required"/>
        <xs:attribute name="currentRammingDamageScore" type="xs:decimal" use="required"/>
        <xs:attribute name="currentRammingKillBonus" type="xs:decimal" use="required"/>
        <xs:attribute name="ver" type="xs:int" use="required"/>
    </xs:complexType>

    <xs:complexType name="robot">
        <xs:sequence>
            <xs:element name="score" type="score"/>
        </xs:sequence>
        <xs:attribute name="ver" type="xs:int" use="required"/>
        <xs:attribute name="name" type="xs:string" use="required"/>
        <xs:attribute name="sName" type="xs:string" use="required"/>
        <xs:attribute name="vsName" type="xs:string" use="required"/>
        <xs:attribute name="teamName" type="xs:string" use="required"/>
        <xs:attribute name="state" type="xs:string" use="required"/>
        <xs:attribute name="energy" type="xs:decimal" use="required"/>
        <xs:attribute name="velocity" type="xs:decimal" use="required"/>
        <xs:attribute name="bodyHeading" type="xs:decimal" use="required"/>
        <xs:attribute name="gunHeading" type="xs:decimal" use="required"/>
        <xs:attribute name="radarHeading" type="xs:decimal" use="required"/>
        <xs:attribute name="x" type="xs:decimal" use="required"/>
        <xs:attribute name="y" type="xs:decimal" use="required"/>
        <xs:attribute name="out" type="xs:string" use="required"/>
    </xs:complexType>

    <xs:complexType name="bullet">
        <xs:attribute name="ver" type="xs:int" use="required"/>
        <xs:attribute name="state" type="xs:string" use="required"/>
        <xs:attribute name="power" type="xs:decimal" use="required"/>
        <xs:attribute name="color" type="xs:int" use="required"/>
        <xs:attribute name="x" type="xs:decimal" use="required"/>
        <xs:attribute name="y" type="xs:decimal" use="required"/>
        <xs:attribute name="frame" type="xs:int" use="required"/>
        <xs:attribute name="isExplosion" type="xs:boolean" use="required"/>
        <xs:attribute name="explosion" type="xs:int" use="optional"/>
    </xs:complexType>

    <xs:complexType name="turn">
        <xs:sequence>
            <xs:element name="robots">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element maxOccurs="unbounded" name="robot" type="robot">
                        </xs:element>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="bullets">
                <xs:complexType>
                    <xs:sequence minOccurs="0">
                        <xs:element maxOccurs="unbounded" name="bullet" type="bullet"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
        </xs:sequence>
        <xs:attribute name="round" type="xs:int" use="required"/>
        <xs:attribute name="turn" type="xs:int" use="required"/>
        <xs:attribute name="ver" type="xs:int" use="required"/>
    </xs:complexType>

    <xs:complexType name="record">
        <xs:sequence>
            <xs:element name="recordInfo" type="recordInfo"/>
            <xs:element name="turn" type="turn" maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>

    <xs:element name="record" type="record"/>

</xs:schema>