<?xml version="1.0" encoding="UTF-8"?>
<!--

    Licensed to Jasig under one or more contributor license
    agreements. See the NOTICE file distributed with this work
    for additional information regarding copyright ownership.
    Jasig licenses this file to you under the Apache License,
    Version 2.0 (the "License"); you may not use this file
    except in compliance with the License. You may obtain a
    copy of the License at:

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on
    an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, either express or implied. See the License for the
    specific language governing permissions and limitations
    under the License.

-->

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns="https://source.jasig.org/schemas/maven-notice-plugin/license-lookup"
    targetNamespace="https://source.jasig.org/schemas/maven-notice-plugin/license-lookup"
    elementFormDefault="qualified">

    <xs:element name="license-lookup">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="artifact" minOccurs="0" maxOccurs="unbounded"
                    type="artifactLicense"/>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:complexType name="artifactLicense">
        <xs:sequence>
            <xs:element name="groupId" type="xs:string">
                <xs:annotation>
                    <xs:documentation source="description"> The artifacts groupId
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="artifactId" type="xs:string">
                <xs:annotation>
                    <xs:documentation source="description"> The artifacts artifactId
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element minOccurs="0" maxOccurs="unbounded" name="version" type="mappedVersion">
                <xs:annotation>
                    <xs:documentation source="description"> Versions of the artifact the overrides
                        should be applied to </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element minOccurs="0" name="name" type="xs:string">
                <xs:annotation>
                    <xs:documentation source="description"> Optional library name to use in the
                        NOTICE file. Overrides the name element form the artifact's pom.xml
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element minOccurs="0" name="license" type="xs:string">
                <xs:annotation>
                    <xs:documentation source="description"> Optional license name to use in the
                        NOTICE file. Overrides and license elements from the artifact's pom.xml
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
        </xs:sequence>            
    </xs:complexType>
    <xs:complexType name="mappedVersion">
        <xs:simpleContent>
            <xs:extension base="xs:string">
                <xs:attribute name="type" default="string" type="versionType">
                    <xs:annotation>
                        <xs:documentation source="description"> Type of version number string. Plain
                            strings, regular expressions and maven version patterns are supported.
                        </xs:documentation>
                    </xs:annotation>
                </xs:attribute>
            </xs:extension>
        </xs:simpleContent>
    </xs:complexType>

    <xs:simpleType name="versionType">
        <xs:restriction base="xs:string">
            <xs:enumeration value="string"/>
            <xs:enumeration value="regex"/>
        </xs:restriction>
    </xs:simpleType>
</xs:schema>
