﻿<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="PingResponse" xml:lang="en" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="PingResponse" type="PingResponseType" />
    <xs:complexType name="PingResponseType">
        <xs:sequence>
            <xs:element name="Result">
                <xs:annotation>
                    <xs:documentation>
                        It can be either "OK" or "ERROR"
                    </xs:documentation>
                </xs:annotation>
                <xs:simpleType>
                    <xs:restriction base="xs:string" />
                </xs:simpleType>
            </xs:element>
            <xs:element name="ErrorType">
                <xs:annotation>
                    <xs:documentation>
                        If "RESULT" is "ERROR", this will contain error type
                    </xs:documentation>
                </xs:annotation>
                <xs:simpleType>
                    <xs:restriction base="xs:string" />
                </xs:simpleType>
            </xs:element>
            <xs:element name="ErrorDescription">
                <xs:annotation>
                    <xs:documentation>
                        If "RESULT" is "ERROR", this will contain error description
                    </xs:documentation>
                </xs:annotation>
                <xs:simpleType>
                    <xs:restriction base="xs:string" />
                </xs:simpleType>
            </xs:element>
            <xs:element name="PingID">
                <xs:annotation>
                    <xs:documentation>
                        ID of the ping in our system
                    </xs:documentation>
                </xs:annotation>
                <xs:simpleType>
                    <xs:restriction base="xs:integer" />
                </xs:simpleType>
            </xs:element>
            <xs:element name="Payout">
                <xs:annotation>
                    <xs:documentation>
                        Payout amount for the lead. For leg-based use cases, this value will represent the total value of all individual leg offers
                    </xs:documentation>
                </xs:annotation>
                <xs:simpleType>
                    <xs:restriction base="xs:decimal" />
                </xs:simpleType>
            </xs:element>
            <xs:element name ="DataFieldValidation" type ="DataFieldValidationType" minOccurs="0" maxOccurs="unbounded">
                <xs:annotation>
                    <xs:documentation>
                        Validation Errors
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="Legs" type="LegsType" minOccurs="0"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="DataFieldValidationType">
        <xs:sequence>
            <xs:element name="DataField">
                <xs:annotation>
                    <xs:documentation>
                        Field where the error occurred
                    </xs:documentation>
                </xs:annotation>
                <xs:simpleType>
                    <xs:restriction base="xs:string" />
                </xs:simpleType>
            </xs:element>
            <xs:element name="DataFieldErrorType">
                <xs:annotation>
                    <xs:documentation>
                        FieldError type
                    </xs:documentation>
                </xs:annotation>
                <xs:simpleType>
                    <xs:restriction base="xs:string" />
                </xs:simpleType>
            </xs:element>
            <xs:element name="DataFieldErrorMessage">
                <xs:annotation>
                    <xs:documentation>
                        Field Error Message
                    </xs:documentation>
                </xs:annotation>
                <xs:simpleType>
                    <xs:restriction base="xs:string" />
                </xs:simpleType>
            </xs:element>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="LegsType">
        <xs:sequence>
            <xs:element name="Leg" type="LegOfferType" maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="LegOfferType">
        <xs:sequence>
            <xs:element name="LegID">
                <xs:annotation>
                    <xs:documentation>Primary unique identifier for this leg</xs:documentation>
                </xs:annotation>
                <xs:simpleType>
                    <xs:restriction base="xs:unsignedLong"/>
                </xs:simpleType>
            </xs:element>
            <xs:element name="Payout">
                <xs:annotation>
                    <xs:documentation>
                        Payout value for this leg
                    </xs:documentation>
                </xs:annotation>
                <xs:simpleType>
                    <xs:restriction base="xs:decimal"/>
                </xs:simpleType>
            </xs:element>
            <xs:element name="CarrierName" minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                        Please refer to the list of Contactability insurance carriers provided with your specification documentation.
                        If an agent is not captive, this field should be equal to "Independent", and "LicenseNumber" must be provided
                    </xs:documentation>
                </xs:annotation>
                <xs:simpleType>
                    <xs:restriction base="xs:string">
                        <xs:maxLength value="64"/>
                    </xs:restriction>
                </xs:simpleType>
            </xs:element>
            <xs:element name="LicenseNumber" minOccurs="0">
                <xs:annotation>
                    <xs:documentation>
                        License Number is a numeric part of corporate residence state license number of an insurance agency, or a personal residence state license number of an insurance agent.
                        All zeros at the beginning of the license number must be trimmed, as well as all non-digit characters.
                        For example: ABC-00123456-0, Must be: 1234560
                    </xs:documentation>
                </xs:annotation>
                <xs:simpleType>
                    <xs:restriction base="xs:long"/>
                </xs:simpleType>
            </xs:element>
        </xs:sequence>
    </xs:complexType>
</xs:schema>
