<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xi="http://www.w3.org/2001/XInclude"
  xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning" vc:minVersion="1.0" vc:maxVersion="1.1">
  <xs:import namespace="http://www.w3.org/XML/1998/namespace"
    schemaLocation="http://www.w3.org/2001/xml.xsd"/>
  <xs:import namespace="http://www.w3.org/2001/XInclude"
    schemaLocation="http://www.w3.org/2001/XInclude/XInclude.xsd"/>
  <xs:include schemaLocation="common.xsd"/>

  <xs:element name="offerte">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="meta"/>
        <xs:element maxOccurs="unbounded" minOccurs="0" ref="generate_index"/>
        <xs:element maxOccurs="unbounded" ref="section"/>
        <xs:element maxOccurs="unbounded" minOccurs="0" ref="annex"/>
        <xs:element maxOccurs="unbounded" minOccurs="1" ref="waivers"/>
      </xs:sequence>
      <xs:attribute ref="xml:lang"/>
    </xs:complexType>
  </xs:element>

  <xs:element name="meta">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="offered_service_long"/>
        <xs:element ref="offered_service_short"/>
        <xs:element ref="company"/>
        <xs:element ref="targets"/>
        <xs:element ref="permission_parties"/>
        <xs:element ref="pentestinfo"/>
        <xs:element ref="version_history"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

  <xs:element name="offered_service_long" type="xs:string"/>
  <xs:element name="offered_service_short" type="xs:string"/>


  <xs:element name="permission_parties">
    <xs:complexType>
      <xs:sequence>
        <xs:element maxOccurs="1" ref="client"/>
        <xs:element maxOccurs="unbounded" minOccurs="0" ref="party"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="party">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="full_name"/>
        <xs:element ref="short_name"/>
        <xs:element ref="waiver_rep"/>
        <xs:element ref="address"/>
        <xs:element ref="city"/>
        <xs:element ref="country"/>
        <xs:element minOccurs="0" ref="coc"/>
      </xs:sequence>
      <xs:attribute name="id" type="xs:ID"/>
    </xs:complexType>
  </xs:element>


  <xs:element name="pentestinfo">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="duration"/>
        <xs:element ref="test_planning"/>
        <xs:element ref="report_due"/>
        <xs:element ref="nature"/>
        <xs:element ref="type"/>
        <xs:element ref="fee"/>
        <xs:element minOccurs="0" ref="target_application"/>
        <xs:element minOccurs="0" ref="target_application_producer"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

  <xs:element name="fee">
    <xs:complexType>
      <xs:simpleContent>
        <xs:extension base="xs:integer">
          <xs:attribute name="denomination" use="optional" default="euro">
            <xs:simpleType>
              <xs:restriction base="xs:string">
                <xs:enumeration value="euro"/>
                <xs:enumeration value="dollar"/>
              </xs:restriction>
            </xs:simpleType>
          </xs:attribute>
        </xs:extension>
      </xs:simpleContent>
    </xs:complexType>
  </xs:element>

  <xs:element name="annex">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="title"/>
        <xs:choice maxOccurs="unbounded">
          <xs:element name="p" type="block"/>
          <xs:element ref="pre"/>
          <xs:element ref="code"/>
          <xs:element ref="table"/>
          <xs:element ref="ol"/>
          <xs:element ref="ul"/>
          <xs:element ref="img"/>
          <xs:element ref="div"/>
          <xs:element ref="section"/>
          <xs:element ref="generate_targets"/>
        </xs:choice>
      </xs:sequence>
      <xs:attribute ref="xml:base"/>
      <xs:attribute ref="xml:lang"/>
      <xs:attribute ref="visibility" use="optional"/>
    </xs:complexType>
  </xs:element>

  <xs:element name="waivers">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="standard_waiver"/>
        <xs:element ref="alternative_waiver" minOccurs="0"/>
      </xs:sequence>
      <xs:attribute ref="xml:base"/>
      <xs:attribute ref="xml:lang"/>
    </xs:complexType>
  </xs:element>

  <xs:element name="standard_waiver">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="title"/>
        <xs:choice maxOccurs="unbounded">
          <xs:element name="p" type="block"/>
          <xs:element ref="ul"/>
          <xs:element ref="generate_targets"/>
        </xs:choice>
        <xs:element ref="generate_waiver_signature_box"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

  <xs:element name="alternative_waiver">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="title"/>
        <xs:choice maxOccurs="unbounded">
          <xs:element name="p" type="block"/>
          <xs:element ref="ul"/>
          <xs:element ref="generate_targets"/>
        </xs:choice>
        <xs:element ref="generate_waiver_signature_box"/>
      </xs:sequence>
      <xs:attribute name="Ref" use="optional" type="xs:IDREFS"/>
    </xs:complexType>
  </xs:element>

  <xs:element name="generate_waiver_signature_box"/>

  <xs:complexType name="block" mixed="true">
    <xs:choice maxOccurs="unbounded">
      <xs:group ref="inline-all"/>
      <xs:element minOccurs="0" maxOccurs="unbounded" ref="generate_permission_parties"/>
      <xs:group ref="placeholders"/>
    </xs:choice>
    <xs:attribute ref="xml:base"/>
  </xs:complexType>

  <xs:element name="section">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="title"/>
        <xs:choice minOccurs="0" maxOccurs="unbounded">
          <xs:element ref="pre"/>
          <xs:element ref="code"/>
          <xs:element name="p" type="block"/>
          <xs:element ref="section"/>
          <xs:element ref="table"/>
          <xs:element ref="ul"/>
          <xs:element ref="ol"/>
          <xs:element ref="img"/>
          <xs:element ref="div"/>
          <xs:element ref="contact"/>
          <xs:element ref="generate_targets"/>
          <xs:element ref="generate_offer_signature_box"/>
        </xs:choice>
      </xs:sequence>
      <xs:attribute name="id" use="optional" type="xs:ID"/>
      <xs:attribute ref="break" use="optional"/>
      <xs:attribute ref="xml:base"/>
      <xs:attribute ref="xml:lang"/>
    </xs:complexType>
  </xs:element>

  <xs:element name="contact">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="name"/>
        <xs:element ref="address"/>
        <xs:element ref="email"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="generate_offer_signature_box"/>
  <xs:element name="generate_permission_parties"/>


  <!-- Placeholders -->
  <xs:group name="placeholders">
    <xs:choice>
      <xs:element name="client_long"/>
      <xs:element name="client_short"/>
      <xs:element name="client_street"/>
      <xs:element name="client_city"/>
      <xs:element name="client_country"/>
      <xs:element name="client_coc"/>
      <xs:element name="client_legal_rep"/>
      <xs:element name="client_waiver_rep"/>
      <xs:element name="client_poc1"/>
      <xs:element name="company_long"/>
      <xs:element name="company_short"/>
      <xs:element name="company_svc_long"/>
      <xs:element name="company_svc_short"/>
      <xs:element name="company_legal_rep"/>
      <xs:element name="company_poc1"/>
      <xs:element name="t_app"/>
      <xs:element name="t_app_producer"/>
      <xs:element name="p_duration"/>
      <xs:element name="p_boxtype"/>
      <xs:element name="p_fee"/>
      <xs:element name="p_testingduration"/>
      <xs:element name="p_reportdue"/>
      <xs:element name="signee_long"/>
      <xs:element name="signee_short"/>
      <xs:element name="signee_street"/>
      <xs:element name="signee_city"/>
      <xs:element name="signee_country"/>
      <xs:element name="signee_waiver_rep"/>
    </xs:choice>
  </xs:group>


</xs:schema>
