<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           xmlns:den="https://den.io/xml/opml"
           targetNamespace="https://den.io/xml/opml"
           elementFormDefault="qualified">

  <xs:annotation>
    <xs:documentation xml:lang="en">
      Den OPML attributes. This namespace defines attributes only; they appear on
      standard OPML outline elements to preserve Den channel and folder settings
      across export and import. Documentation: https://den.io/xml/opml
    </xs:documentation>
  </xs:annotation>

  <xs:simpleType name="lowercaseBoolean">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        Boolean restricted to lowercase "true"/"false". The numeric forms "1"/"0"
        permitted by xs:boolean are not recognized by Den's importer.
      </xs:documentation>
    </xs:annotation>
    <xs:restriction base="xs:string">
      <xs:enumeration value="true"/>
      <xs:enumeration value="false"/>
    </xs:restriction>
  </xs:simpleType>

  <!-- Folder outline attributes -->

  <xs:attribute name="icon" type="xs:string">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        SF Symbols name for a folder outline's icon, e.g. "globe.americas".
        Defaults to "folder" when absent.
      </xs:documentation>
    </xs:annotation>
  </xs:attribute>

  <!-- Channel outline attributes (outlines with an xmlUrl) -->

  <xs:attribute name="disableBlocklists" type="den:lowercaseBoolean">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        Disables content blocklists for the channel's viewer. Defaults to "false".
      </xs:documentation>
    </xs:annotation>
  </xs:attribute>

  <xs:attribute name="disableJavaScript" type="den:lowercaseBoolean">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        Disables JavaScript in the channel's viewer. Defaults to "false".
      </xs:documentation>
    </xs:annotation>
  </xs:attribute>

  <xs:attribute name="generatePreviewSummaries" type="den:lowercaseBoolean">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        Enables machine-generated preview summaries for the channel's articles.
        Defaults to "false".
      </xs:documentation>
    </xs:annotation>
  </xs:attribute>

  <xs:attribute name="viewerMode">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        Preferred article presentation for the channel. When absent, Den chooses
        automatically.
      </xs:documentation>
    </xs:annotation>
    <xs:simpleType>
      <xs:restriction base="xs:string">
        <xs:enumeration value="web"/>
        <xs:enumeration value="comments"/>
        <xs:enumeration value="content"/>
        <xs:enumeration value="reader"/>
      </xs:restriction>
    </xs:simpleType>
  </xs:attribute>

  <xs:attribute name="fetchLimit">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        Maximum number of articles kept per fetch. Values outside the range are
        clamped on import. Defaults to 10.
      </xs:documentation>
    </xs:annotation>
    <xs:simpleType>
      <xs:restriction base="xs:int">
        <xs:minInclusive value="1"/>
        <xs:maxInclusive value="1000"/>
      </xs:restriction>
    </xs:simpleType>
  </xs:attribute>

  <xs:attribute name="retentionPeriod">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        Article retention period in days. Values outside the range are clamped
        on import. Defaults to 30.
      </xs:documentation>
    </xs:annotation>
    <xs:simpleType>
      <xs:restriction base="xs:int">
        <xs:minInclusive value="1"/>
        <xs:maxInclusive value="3650"/>
      </xs:restriction>
    </xs:simpleType>
  </xs:attribute>

  <xs:attribute name="ttl" type="xs:nonNegativeInteger">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        Minimum time between feed refreshes, in minutes. Negative values are
        clamped to 0 on import.
      </xs:documentation>
    </xs:annotation>
  </xs:attribute>

  <xs:attribute name="translationLanguage" type="xs:language">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        Target language for automatic article translation, as a BCP 47 language
        code, e.g. "en". Absent when translation is off.
      </xs:documentation>
    </xs:annotation>
  </xs:attribute>

  <xs:attribute name="languageOverride" type="xs:language">
    <xs:annotation>
      <xs:documentation xml:lang="en">
        Manual source-language override for the channel, as a BCP 47 language
        code, e.g. "de". Used when a feed misreports its language.
      </xs:documentation>
    </xs:annotation>
  </xs:attribute>

</xs:schema>
