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

    BleachBit
    Copyright (C) 2008-2024 Andrew Ziem
    https://www.bleachbit.org

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
  <xs:attributeGroup name="operatingSystem">
    <xs:attribute name="os" use="optional">
      <xs:simpleType>
        <xs:restriction base="xs:string">
          <xs:enumeration value="bsd"/>
          <xs:enumeration value="darwin"/>
          <xs:enumeration value="linux"/>
          <xs:enumeration value="netbsd"/>
          <xs:enumeration value="openbsd"/>
          <xs:enumeration value="freebsd"/>
          <xs:enumeration value="unix"/>
          <xs:enumeration value="windows"/>
        </xs:restriction>
      </xs:simpleType>
    </xs:attribute>
  </xs:attributeGroup>
  <xs:element name="cleaner">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="label">
          <xs:complexType>
            <xs:simpleContent>
              <xs:extension base="xs:string">
                <xs:attribute name="translate" type="xs:boolean" default="false"/>
              </xs:extension>
            </xs:simpleContent>
          </xs:complexType>
        </xs:element>
        <xs:element name="description" minOccurs="0" maxOccurs="1">
          <xs:complexType>
            <xs:simpleContent>
              <xs:extension base="xs:string">
                <xs:attribute name="translators" type="xs:string"/>
              </xs:extension>
            </xs:simpleContent>
          </xs:complexType>
        </xs:element>
        <xs:element name="running" minOccurs="0" maxOccurs="unbounded">
          <xs:complexType>
            <xs:simpleContent>
              <xs:extension base="xs:string">
                <xs:attributeGroup ref="operatingSystem"/>
                <xs:attribute name="type" use="required">
                  <xs:simpleType>
                    <xs:restriction base="xs:string">
                      <xs:enumeration value="exe"/>
                      <xs:enumeration value="pathname"/>
                    </xs:restriction>
                  </xs:simpleType>
                </xs:attribute>
              </xs:extension>
            </xs:simpleContent>
          </xs:complexType>
        </xs:element>
        <xs:element name="var" minOccurs="0" maxOccurs="unbounded">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="value" minOccurs="1" maxOccurs="unbounded">
                <xs:complexType>
                  <xs:simpleContent>
                    <xs:extension base="xs:string">
                      <xs:attributeGroup ref="operatingSystem"/>
                      <xs:attribute name="search" use="optional" type="xs:string"/>
                    </xs:extension>
                  </xs:simpleContent>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
            <xs:attribute name="name" type="xs:string" use="required"/>
          </xs:complexType>
        </xs:element>
        <xs:element name="option" minOccurs="0" maxOccurs="unbounded">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="label">
                <xs:complexType>
                  <xs:simpleContent>
                    <xs:extension base="xs:string">
                      <xs:attribute name="translate" type="xs:boolean" default="false"/>
                      <xs:attribute name="translators" type="xs:string"/>
                    </xs:extension>
                  </xs:simpleContent>
                </xs:complexType>
              </xs:element>
              <xs:element name="description">
                <xs:complexType>
                  <xs:simpleContent>
                    <xs:extension base="xs:string">
                      <xs:attribute name="translators" type="xs:string"/>
                    </xs:extension>
                  </xs:simpleContent>
                </xs:complexType>
              </xs:element>
              <xs:element name="warning" type="xs:string" minOccurs="0" maxOccurs="1"/>
              <xs:element name="action" maxOccurs="unbounded">
                <xs:complexType>
                  <xs:simpleContent>
                    <xs:extension base="xs:string">
                      <xs:attribute name="address" type="xs:string"/>
                      <xs:attribute name="command" use="required">
                        <xs:simpleType>
                          <xs:restriction base="xs:string">
                            <xs:enumeration value="apt.clean"/>
                            <xs:enumeration value="apt.autoclean"/>
                            <xs:enumeration value="apt.autoremove"/>
                            <xs:enumeration value="chrome.autofill"/>
                            <xs:enumeration value="chrome.databases_db"/>
                            <xs:enumeration value="chrome.favicons"/>
                            <xs:enumeration value="chrome.history"/>
                            <xs:enumeration value="chrome.keywords"/>
                            <xs:enumeration value="delete"/>
                            <xs:enumeration value="dnf.autoremove"/>
                            <xs:enumeration value="dnf.clean_all"/>
                            <xs:enumeration value="ini"/>
                            <xs:enumeration value="journald.clean"/>
                            <xs:enumeration value="json"/>
                            <xs:enumeration value="mozilla.favicons"/>
                            <xs:enumeration value="mozilla.url.history"/>
                            <xs:enumeration value="office_registrymodifications"/>
                            <xs:enumeration value="process"/>
                            <xs:enumeration value="sqlite.vacuum"/>
                            <xs:enumeration value="truncate"/>
                            <xs:enumeration value="win.shell.change.notify"/>
                            <xs:enumeration value="winreg"/>
                            <xs:enumeration value="yum.clean_all"/>
                          </xs:restriction>
                        </xs:simpleType>
                      </xs:attribute>
                      <xs:attribute name="cmd" type="xs:string"/>
                      <xs:attribute name="name" type="xs:string"/>
                      <xs:attribute name="parameter" type="xs:string"/>
                      <xs:attribute name="path" type="xs:string"/>
                      <xs:attribute name="regex" type="xs:string"/>
                      <xs:attribute name="nregex" type="xs:string"/>
                      <xs:attribute name="wholeregex" type="xs:string"/>
                      <xs:attribute name="nwholeregex" type="xs:string"/>
                      <xs:attribute name="type" type="xs:string"/>
                      <xs:attribute name="wait" type="xs:string"/>
                      <xs:attributeGroup ref="operatingSystem"/>
                      <xs:attribute name="search">
                        <xs:simpleType>
                          <xs:restriction base="xs:string">
                            <xs:enumeration value="deep"/>
                            <xs:enumeration value="file"/>
                            <xs:enumeration value="glob"/>
                            <xs:enumeration value="walk.all"/>
                            <xs:enumeration value="walk.files"/>
                            <xs:enumeration value="walk.top"/>
                          </xs:restriction>
                        </xs:simpleType>
                      </xs:attribute>
                      <xs:attribute name="section" type="xs:string"/>
                    </xs:extension>
                  </xs:simpleContent>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
            <xs:attribute name="id" type="xs:string" use="required"/>
          </xs:complexType>
        </xs:element>
        <xs:element name="localizations" minOccurs="0">
          <xs:complexType>
            <xs:sequence>
              <xs:element ref="path" maxOccurs="unbounded"/>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
      <xs:attribute name="id" type="xs:string" use="required"/>
      <xs:attributeGroup ref="operatingSystem"/>
    </xs:complexType>
  </xs:element>
  <xs:element name="path">
    <xs:complexType>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element ref="path"/>
        <xs:element name="regexfilter">
          <xs:complexType>
            <xs:attribute name="prefix" type="xs:string" use="optional"/>
            <xs:attribute name="postfix" type="xs:string" use="optional"/>
          </xs:complexType>
        </xs:element>
      </xs:choice>
      <xs:attribute name="directoryregex" type="xs:string" use="optional"/>
      <xs:attribute name="location" type="xs:string" use="optional" default="."/>
      <xs:attribute name="filter" type="xs:string" use="optional" default="*"/>
    </xs:complexType>
  </xs:element>
</xs:schema>
