<?xml version="1.0" encoding="UTF-8"?>
<!--
    freedesktop.org shared-mime-info definition.

    Install with:
        sudo cp dkr.xml /usr/share/mime/packages/dekra.xml
        sudo update-mime-database /usr/share/mime

    After that a Linux desktop, and anything using xdg-mime, knows what a .dkr
    file is without opening it. The `magic` block matters more than the glob:
    a file arriving from a mail attachment or a download often has no useful
    name, and the content is the only thing left to go on.
-->
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">

  <mime-type type="application/vnd.dkr+json">
    <comment>DEKRA business document collection</comment>
    <comment xml:lang="lv">DEKRA dokumentu kopa</comment>
    <comment xml:lang="ru">Набор документов DEKRA</comment>
    <comment xml:lang="lt">DEKRA dokumentų rinkinys</comment>
    <comment xml:lang="et">DEKRA dokumendikogum</comment>

    <!-- It is JSON, and every JSON tool should be allowed to treat it as such. -->
    <sub-class-of type="application/json"/>

    <glob pattern="*.dkr"/>

    <!--
        The container always opens with `"format": "DEKRA"` as its first key,
        because the producer emits the keys in the standard's order. The offset
        range covers a leading BOM, whitespace and pretty-printing.
    -->
    <magic priority="60">
      <match type="string" value="&quot;format&quot;" offset="0:16">
        <match type="string" value="&quot;DEKRA&quot;" offset="10:40"/>
      </match>
    </magic>
  </mime-type>

  <mime-type type="application/vnd.dkr+jsonl">
    <comment>DEKRA document stream</comment>
    <comment xml:lang="lv">DEKRA dokumentu plūsma</comment>
    <comment xml:lang="ru">Поток документов DEKRA</comment>
    <comment xml:lang="lt">DEKRA dokumentų srautas</comment>
    <comment xml:lang="et">DEKRA dokumendivoog</comment>

    <glob pattern="*.dkrs"/>

    <magic priority="60">
      <match type="string" value="{&quot;format&quot;:&quot;DEKRA&quot;" offset="0:4"/>
    </magic>
  </mime-type>

</mime-info>
