<?xml version="1.0"?>
<!--
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:redefine schemaLocation="urn:magento:framework:Data/etc/argument/types.xsd"/>
    <xs:element name="config">
        <xs:complexType>
            <xs:choice maxOccurs="unbounded">
                <xs:element name="type" minOccurs="0" maxOccurs="unbounded">
                    <xs:complexType>
                        <xs:all>
                            <xs:element type="xs:string" name="preview_template" minOccurs="0"/>
                            <xs:element type="xs:string" name="master_template" minOccurs="0"/>
                            <xs:element type="parents" name="parents" minOccurs="0" maxOccurs="1"/>
                            <xs:element type="children" name="children" minOccurs="0" maxOccurs="1"/>
                            <xs:element name="appearances" minOccurs="0" maxOccurs="1">
                                <xs:complexType>
                                    <xs:sequence>
                                        <xs:element type="appearance" name="appearance" minOccurs="1" maxOccurs="unbounded"/>
                                    </xs:sequence>
                                </xs:complexType>
                            </xs:element>
                            <xs:element type="additional_data" name="additional_data" minOccurs="0" maxOccurs="1"/>
                            <xs:element type="xs:string" name="is_system" minOccurs="0"/>
                        </xs:all>
                        <xs:attribute type="xs:string" name="name" use="required"/>
                        <xs:attribute type="xs:string" name="translate" use="optional"/>
                        <xs:attribute type="xs:byte" name="sortOrder" use="optional"/>
                        <xs:attribute type="xs:string" name="label" use="optional"/>
                        <xs:attribute type="xs:string" name="icon" use="optional"/>
                        <xs:attribute type="xs:string" name="component" use="optional"/>
                        <xs:attribute type="xs:string" name="preview_component" use="optional"/>
                        <xs:attribute type="xs:string" name="master_component" use="optional"/>
                        <xs:attribute type="xs:string" name="form" use="optional"/>
                        <xs:attribute type="xs:string" name="menu_section" use="optional"/>
                    </xs:complexType>
                </xs:element>
            </xs:choice>
        </xs:complexType>
    </xs:element>
    <xs:complexType name="appearance">
        <xs:choice maxOccurs="unbounded">
            <xs:element name="data" minOccurs="0" maxOccurs="unbounded">
                <xs:complexType>
                    <xs:simpleContent>
                        <xs:extension base="xs:string">
                            <xs:attribute type="xs:string" name="name"/>
                        </xs:extension>
                    </xs:simpleContent>
                </xs:complexType>
            </xs:element>
            <xs:element type="elements" name="elements" minOccurs="0" maxOccurs="1"/>
            <xs:element type="converters" name="converters" minOccurs="0" maxOccurs="1"/>
            <xs:element type="xs:string" name="form" minOccurs="0" maxOccurs="1"/>
        </xs:choice>
        <xs:attribute type="xs:string" name="name" use="required"/>
        <xs:attribute type="xs:boolean" name="default" use="optional"/>
        <xs:attribute type="xs:string" name="preview_template" use="optional"/>
        <xs:attribute type="xs:string" name="master_template" use="optional"/>
        <xs:attribute type="xs:string" name="reader" use="optional"/>
    </xs:complexType>
    <xs:complexType name="parents">
        <xs:sequence>
            <xs:element type="parent" name="parent" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
        <xs:attribute type="xs:string" name="default_policy" use="optional"/>
    </xs:complexType>
    <xs:complexType name="children">
        <xs:sequence>
            <xs:element type="child" name="child" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
        <xs:attribute type="xs:string" name="default_policy" use="optional"/>
    </xs:complexType>
    <xs:complexType name="parent">
        <xs:attribute type="xs:string" name="name" use="required"/>
        <xs:attribute type="xs:string" name="policy" use="optional"/>
    </xs:complexType>
    <xs:complexType name="child">
        <xs:attribute type="xs:string" name="name" use="required"/>
        <xs:attribute type="xs:string" name="policy" use="optional"/>
    </xs:complexType>
    <xs:complexType name="elements">
        <xs:sequence>
            <xs:element type="element" name="element" minOccurs="1" maxOccurs="unbounded">
                <xs:unique name="uniqueNames">
                    <xs:annotation>
                        <xs:documentation>
                            Attribute and Style names must be unique
                        </xs:documentation>
                    </xs:annotation>
                    <xs:selector xpath="attribute|style"/>
                    <xs:field xpath="@name"/>
                </xs:unique>
            </xs:element>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="converters">
        <xs:sequence>
            <xs:element type="converter" name="converter" minOccurs="1" maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="converter">
        <xs:sequence>
            <xs:element type="config" name="config" minOccurs="0"/>
        </xs:sequence>
        <xs:attribute type="xs:string" name="name" use="required"/>
        <xs:attribute type="xs:string" name="component" use="optional"/>
    </xs:complexType>
    <xs:complexType name="config">
        <xs:sequence>
            <xs:element type="item" name="item" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="item">
        <xs:attribute type="xs:string" name="name" use="required"/>
        <xs:attribute type="xs:string" name="value" use="optional"/>
    </xs:complexType>
    <xs:complexType name="element">
        <xs:choice maxOccurs="unbounded">
            <xs:element type="style" name="style" minOccurs="0" maxOccurs="unbounded"/>
            <xs:element type="static_style" name="static_style" minOccurs="0" maxOccurs="unbounded"/>
            <xs:element type="attribute" name="attribute" minOccurs="0" maxOccurs="unbounded"/>
            <xs:element type="static_attribute" name="static_attribute" minOccurs="0" maxOccurs="unbounded"/>
            <xs:element type="tag" name="tag" minOccurs="0" maxOccurs="1"/>
            <xs:element type="html" name="html" minOccurs="0" maxOccurs="1"/>
            <xs:element type="css" name="css" minOccurs="0" maxOccurs="1"/>
        </xs:choice>
        <xs:attribute type="xs:string" name="name" use="required"/>
    </xs:complexType>
    <xs:complexType name="additional_data">
        <xs:choice maxOccurs="unbounded">
            <xs:element type="argumentType" name="item" minOccurs="1" maxOccurs="unbounded"/>
        </xs:choice>
    </xs:complexType>
    <xs:complexType name="style">
        <xs:attribute type="xs:string" name="name" use="required"/>
        <xs:attribute type="xs:string" name="source" use="optional"/>
        <xs:attribute type="xs:string" name="converter" use="optional"/>
        <xs:attribute type="xs:string" name="preview_converter" use="optional"/>
        <xs:attribute type="xs:string" name="persistence_mode" use="optional"/>
        <xs:attribute type="xs:string" name="storage_key" use="optional"/>
        <xs:attribute type="xs:string" name="reader" use="optional"/>
    </xs:complexType>
    <xs:complexType name="static_style">
        <xs:attribute type="xs:string" name="source" use="required"/>
        <xs:attribute type="xs:string" name="value" use="optional"/>
    </xs:complexType>
    <xs:complexType name="attribute">
        <xs:attribute type="xs:string" name="name" use="required"/>
        <xs:attribute type="xs:string" name="source" use="optional"/>
        <xs:attribute type="xs:string" name="converter" use="optional"/>
        <xs:attribute type="xs:string" name="preview_converter" use="optional"/>
        <xs:attribute type="xs:string" name="persistence_mode" use="optional"/>
        <xs:attribute type="xs:string" name="storage_key" use="optional"/>
        <xs:attribute type="xs:string" name="reader" use="optional"/>
    </xs:complexType>
    <xs:complexType name="static_attribute">
        <xs:attribute type="xs:string" name="source" use="required"/>
        <xs:attribute type="xs:string" name="value" use="optional"/>
    </xs:complexType>
    <xs:complexType name="html">
        <xs:attribute type="xs:string" name="name" use="required"/>
        <xs:attribute type="xs:string" name="converter" use="optional"/>
        <xs:attribute type="xs:string" name="preview_converter" use="optional"/>
    </xs:complexType>
    <xs:complexType name="css">
        <xs:sequence>
            <xs:element type="filter" name="filter" minOccurs="0" maxOccurs="1"/>
        </xs:sequence>
        <xs:attribute type="xs:string" name="name" use="required"/>
    </xs:complexType>
    <xs:complexType name="filter">
        <xs:sequence>
            <xs:element type="class" name="class" minOccurs="1" maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>
    <xs:complexType name="class">
        <xs:attribute type="xs:string" name="source" use="required"/>
    </xs:complexType>
    <xs:complexType name="tag">
        <xs:attribute type="xs:string" name="name" use="required"/>
        <xs:attribute type="xs:string" name="converter" use="optional"/>
    </xs:complexType>
</xs:schema>
