<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="config">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="option" type="optionDeclaration" minOccurs="1" maxOccurs="unbounded">
                    <xs:unique name="uniqueInputTypeName">
                        <xs:annotation>
                            <xs:documentation>
                                Input type name must be unique.
                            </xs:documentation>
                        </xs:annotation>
                        <xs:selector xpath="inputType" />
                        <xs:field xpath="@name" />
                    </xs:unique>
                </xs:element>
            </xs:sequence>
        </xs:complexType>
        <xs:unique name="uniqueOptionName">
            <xs:annotation>
                <xs:documentation>
                    Option name must be unique.
                </xs:documentation>
            </xs:annotation>
            <xs:selector xpath="option" />
            <xs:field xpath="@name" />
        </xs:unique>
    </xs:element>

    <xs:complexType name="optionDeclaration">
        <xs:annotation>
            <xs:documentation>
                Option declaration.
            </xs:documentation>
        </xs:annotation>
        <xs:sequence>
            <xs:element name="inputType" type="inputTypeDeclaration" minOccurs="1" maxOccurs="unbounded" />
        </xs:sequence>
        <xs:attribute name="name" type="xs:string" use="required" />
        <xs:attribute name="label" type="xs:string" use="optional" />
        <xs:attribute name="renderer" type="modelName" use="optional" />
    </xs:complexType>

    <xs:complexType name="inputTypeDeclaration">
        <xs:annotation>
            <xs:documentation>
                Input type declaration.
            </xs:documentation>
        </xs:annotation>
        <xs:attribute name="name" type="xs:string" use="required" />
        <xs:attribute name="label" type="xs:string" use="optional" />
        <xs:attribute name="disabled" type="xs:boolean" use="optional" />
    </xs:complexType>

    <xs:simpleType name="modelName">
        <xs:annotation>
            <xs:documentation>
                Model name can contain only [a-zA-Z_\\].
            </xs:documentation>
        </xs:annotation>
        <xs:restriction base="xs:string">
            <xs:pattern value="[a-zA-Z_\\]+" />
        </xs:restriction>
    </xs:simpleType>
</xs:schema>
