<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
  <xs:element name="joblistings">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="job"/>
      </xs:sequence>
      <xs:attribute name="export_type">
        <xs:annotation>
          <xs:documentation xml:lang="DE">Spezifikation des Import-Typs: Voll- (full) oder Teilabgleich (partial) handelt</xs:documentation>
          <xs:documentation xml:lang="EN">Specification of import-type: full or partial</xs:documentation>
        </xs:annotation>
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:enumeration value="full"/>
            <xs:enumeration value="partial"/>
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
    </xs:complexType>
  </xs:element>
  <xs:element name="job">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="provider_id" minOccurs="0"/>
        <xs:element ref="title"/>
        <xs:element ref="description"/>
        <xs:element ref="boxnumber" minOccurs="0"/>
        <xs:element ref="teaser" minOccurs="0"/>
        <xs:element ref="link" minOccurs="0"/>
        <xs:element ref="keywords" minOccurs="0"/>
        <xs:element ref="contract_type" minOccurs="0"/>
        <xs:element ref="contract_types" minOccurs="0">
          <xs:annotation>
            <xs:documentation xml:lang="DE">Kann mehrere Beschäftigungsarten, kommegetrennt, enthalten</xs:documentation>
            <xs:documentation xml:lang="EN">Can include more then one type, comma-separated</xs:documentation>
          </xs:annotation>
        </xs:element>
        <xs:element ref="subtitle" minOccurs="0"/>
        <xs:element ref="jobsites"/>
        <xs:element ref="sectors" minOccurs="0"/>
        <xs:element ref="operationalareas" minOccurs="0"/>
        <xs:element ref="tags" minOccurs="0"/>
        <xs:element ref="contact_person" maxOccurs="unbounded" minOccurs="0"/>
        <xs:element ref="employer"/>
        <xs:element ref="attachments" minOccurs="0"/>
      </xs:sequence>
      <xs:attribute name="created_date" use="optional" type="xs:date"/>
      <xs:attribute name="expire_date" use="optional" type="xs:dateTime"/>
      <xs:attribute name="external_id" use="required" type="xs:string"/>
      <xs:attribute name="status" use="optional">
        <xs:annotation>
          <xs:documentation>Hat den Status 'active' oder 'inactive'.
Wenn auf 'inactive' gesetzt wurde, muss auch das expire_date gesetzt sein.</xs:documentation>
        </xs:annotation>
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:enumeration value="active"/>
            <xs:enumeration value="inactive"/>
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
      <xs:attribute name="delete" type="xs:boolean">
        <xs:annotation>
          <xs:documentation xml:lang="DE">Muss bei Teilabgleichen zur Löschung eines Jobs gesetzt werden, nicht relevant für Vollabgleiche.</xs:documentation>
          <xs:documentation xml:lang="EN">Has to be set for deletion of a job when doing partial-imports, not relevant for full-imports</xs:documentation>
        </xs:annotation>
      </xs:attribute>
    </xs:complexType>
  </xs:element>
  <xs:element name="provider_id" type="xs:string"/>
  <xs:element name="boxnumber" type="xs:string"/>
  <xs:element name="teaser" type="xs:string"/>
  <xs:element name="link" type="xs:anyURI"/>
  <xs:element name="keywords" type="xs:string"/>
  <xs:element name="contract_type" type="xs:string"/>
  <xs:element name="contract_types" type="xs:string"/>
  <xs:element name="subtitle" type="xs:string"/>
  <xs:element name="jobsites">
    <xs:complexType>
      <xs:sequence>
        <xs:element maxOccurs="unbounded" ref="address"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="sectors">
    <xs:complexType>
      <xs:sequence>
        <xs:element maxOccurs="unbounded" ref="sector"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="sector" type="xs:string"/>
  <xs:element name="operationalareas">
    <xs:complexType>
      <xs:sequence>
        <xs:element maxOccurs="unbounded" ref="operationalarea"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="operationalarea" type="xs:string"/>
  <xs:element name="tags">
    <xs:complexType>
      <xs:sequence>
        <xs:element maxOccurs="unbounded" ref="tag"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="tag" type="xs:NCName"/>
  <xs:element name="contact_person">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="name" minOccurs="0"/>
        <xs:element ref="description" minOccurs="0"/>
        <xs:element ref="address" minOccurs="0"/>
        <xs:element maxOccurs="unbounded" ref="contact" minOccurs="0"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="employer">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="external_id"/>
        <xs:element ref="name"/>
        <xs:element ref="address" minOccurs="0"/>
        <xs:element maxOccurs="unbounded" ref="contact" minOccurs="0"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="external_id" type="xs:string"/>
  <xs:element name="attachments">
    <xs:complexType>
      <xs:sequence>
        <xs:element maxOccurs="unbounded" ref="attachment"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="attachment">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="data"/>
        <xs:element ref="title" minOccurs="0"/>
      </xs:sequence>
      <xs:attribute name="format" use="optional" type="xs:string"/>
      <xs:attribute name="group" use="optional" type="xs:string"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="data">
    <xs:complexType mixed="true">
      <xs:attribute name="type" use="required">
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:enumeration value="path"/>
            <xs:enumeration value="base64"/>
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
    </xs:complexType>
  </xs:element>
  <xs:element name="title" type="xs:string"/>
  <xs:element name="description" type="xs:string"/>
  <xs:element name="address">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="street" minOccurs="0"/>
        <xs:element ref="extra" minOccurs="0"/>
        <xs:element ref="city"/>
        <xs:element ref="zip"/>
        <xs:element ref="country" minOccurs="1"/>
      </xs:sequence>
      <xs:attribute name="description" use="optional" type="xs:string"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="street" type="xs:string"/>
  <xs:element name="extra" type="xs:string"/>
  <xs:element name="city" type="xs:string"/>
  <xs:element name="zip" type="xs:string"/>
  <xs:element name="country" type="xs:string"/>
  <xs:element name="name" type="xs:string"/>
  <xs:element name="contact">
    <xs:complexType>
      <xs:simpleContent>
        <xs:extension base="xs:string">
          <xs:attribute name="type" use="required">
            <xs:simpleType>
              <xs:restriction base="xs:string">
                <xs:enumeration value="email"/>
                <xs:enumeration value="phone"/>
                <xs:enumeration value="web"/>
              </xs:restriction>
            </xs:simpleType>
          </xs:attribute>
          <xs:attribute name="title" use="optional" type="xs:string"/>
        </xs:extension>
      </xs:simpleContent>
    </xs:complexType>
  </xs:element>
</xs:schema>
