version: "SiBCS 5a edicao (Embrapa, 2018)"
implementation_status: "soilKey v0.7 -- 13/13 ordens wired (Cap 4 chave canonica)"
source: |
  Empresa Brasileira de Pesquisa Agropecuaria (Embrapa). Embrapa Solos.
  Sistema Brasileiro de Classificacao de Solos. 5a ed. rev. e ampl.
  Brasilia, DF: Embrapa, 2018, 356 p. ISBN 978-85-7035-800-4.

# CHAVE CANONICA DO 1o NIVEL (Cap 4, pp 110-114).
#
# A chave do SiBCS 5a ed. nao segue ordem alfabetica -- ela testa
# primeiro as ordens com sinais mais distintivos:
#   1. Organossolos (O)  -- horizonte histico dominante
#   2. Neossolos    (R)  -- sem horizonte B diagnostico
#   3. Vertissolos  (V)  -- horizonte vertico dentro 100 cm
#   4. Espodossolos (E)  -- B espodico
#   5. Planossolos  (S)  -- B planico (sem coincidencia plintico)
#   6. Gleissolos   (G)  -- horizonte glei
#   7. Latossolos   (L)  -- B latossolico
#   8. Chernossolos (M)  -- A chernozemico + alta sat / carbonatos
#   9. Cambissolos  (C)  -- B incipiente (sem plintossolo)
#  10. Plintossolos (F)  -- horizonte plintico
#  11. Luvissolos   (T)  -- B textural + Ta + V alta
#  12. Nitossolos   (N)  -- B nitico + clay >= 35%
#  13. Argissolos   (P)  -- B textural (catch-all)
#
# v0.7 wiring: cada ordem chama seu RSG-level diagnostic em
# R/diagnostics-rsg-sibcs.R, que aplica o gate canonico AND a exclusao
# das classes que vem antes na chave.

ordens:

  - code: "O"
    name: Organossolos
    tests:
      all_of:
        - organossolo: {}

  - code: "R"
    name: Neossolos
    tests:
      all_of:
        - neossolo: {}

  - code: "V"
    name: Vertissolos
    tests:
      all_of:
        - vertissolo: {}

  - code: "E"
    name: Espodossolos
    tests:
      all_of:
        - espodossolo: {}

  - code: "S"
    name: Planossolos
    tests:
      all_of:
        - planossolo: {}

  - code: "G"
    name: Gleissolos
    tests:
      all_of:
        - gleissolo: {}

  - code: "L"
    name: Latossolos
    tests:
      all_of:
        - latossolo: {}

  - code: "M"
    name: Chernossolos
    tests:
      all_of:
        - chernossolo: {}

  - code: "C"
    name: Cambissolos
    tests:
      all_of:
        - cambissolo: {}

  - code: "F"
    name: Plintossolos
    tests:
      all_of:
        - plintossolo: {}

  - code: "T"
    name: Luvissolos
    tests:
      all_of:
        - luvissolo: {}

  - code: "N"
    name: Nitossolos
    tests:
      all_of:
        - nitossolo: {}

  - code: "P"
    name: Argissolos
    tests:
      all_of:
        - argissolo: {}
    notes: "Catch-all final: B textural que nao se enquadra em Luvissolos / Nitossolos."

# =============================================================
# CHAVE DO 2o NIVEL (subordens) -- Caps 5-17
# =============================================================
#
# v0.7.2: cada subordem usa o contrato canonico tests:{all_of:[...]}
# (igual ao bloco ordens: acima, ao bloco rsgs: do WRB e ao bloco
# orders: do USDA), o que permite iterar via run_taxa_list() generico.
# A ultima subordem de cada ordem usa tests:{default:true} e e o
# catch-all canonico (Haplicos / Vermelho-Amarelos / Regoliticos /
# Ferri-humiluvicos), conforme a chave dos Caps 5-17.

subordens:

  # -----------------------------------------------------------
  # P -- Argissolos (Cap 5)  ------------------------------------
  # -----------------------------------------------------------
  "P":
    - code: "PBAC"
      name: "Argissolos Bruno-Acinzentados"
      tests:
        all_of:
          - argissolo_bruno_acinzentado: {}
    - code: "PAC"
      name: "Argissolos Acinzentados"
      tests:
        all_of:
          - argissolo_acinzentado: {}
    - code: "PA"
      name: "Argissolos Amarelos"
      tests:
        all_of:
          - argissolo_amarelo: {}
    - code: "PV"
      name: "Argissolos Vermelhos"
      tests:
        all_of:
          - argissolo_vermelho: {}
    - code: "PVA"
      name: "Argissolos Vermelho-Amarelos"
      tests:
        default: true
      notes: "Catch-all final dos Argissolos."

  # -----------------------------------------------------------
  # C -- Cambissolos (Cap 6)
  # -----------------------------------------------------------
  "C":
    - code: "CH"
      name: "Cambissolos Histicos"
      tests:
        all_of:
          - cambissolo_histico: {}
    - code: "CHU"
      name: "Cambissolos Humicos"
      tests:
        all_of:
          - cambissolo_humico: {}
    - code: "CY"
      name: "Cambissolos Fluvicos"
      tests:
        all_of:
          - cambissolo_fluvico: {}
    - code: "CX"
      name: "Cambissolos Haplicos"
      tests:
        default: true
      notes: "Catch-all final dos Cambissolos."

  # -----------------------------------------------------------
  # M -- Chernossolos (Cap 7)
  # -----------------------------------------------------------
  "M":
    - code: "MD"
      name: "Chernossolos Rendzicos"
      tests:
        all_of:
          - chernossolo_rendzico: {}
    - code: "ME"
      name: "Chernossolos Ebanicos"
      tests:
        all_of:
          - chernossolo_ebanico: {}
    - code: "MT"
      name: "Chernossolos Argiluvicos"
      tests:
        all_of:
          - chernossolo_argiluvico: {}
    - code: "MX"
      name: "Chernossolos Haplicos"
      tests:
        default: true
      notes: "Catch-all final dos Chernossolos."

  # -----------------------------------------------------------
  # E -- Espodossolos (Cap 8)
  # -----------------------------------------------------------
  "E":
    - code: "EK"
      name: "Espodossolos Humiluvicos"
      tests:
        all_of:
          - espodossolo_humiluvico: {}
    - code: "EJ"
      name: "Espodossolos Ferriluvicos"
      tests:
        all_of:
          - espodossolo_ferriluvico: {}
    - code: "ES"
      name: "Espodossolos Ferri-humiluvicos"
      tests:
        default: true
      notes: "Catch-all final dos Espodossolos."

  # -----------------------------------------------------------
  # G -- Gleissolos (Cap 9)
  # -----------------------------------------------------------
  "G":
    - code: "GJ"
      name: "Gleissolos Tiomorficos"
      tests:
        all_of:
          - gleissolo_tiomorfico: {}
    - code: "GZ"
      name: "Gleissolos Salicos"
      tests:
        all_of:
          - gleissolo_salico: {}
    - code: "GM"
      name: "Gleissolos Melanicos"
      tests:
        all_of:
          - gleissolo_melanico: {}
    - code: "GX"
      name: "Gleissolos Haplicos"
      tests:
        default: true
      notes: "Catch-all final dos Gleissolos."

  # -----------------------------------------------------------
  # L -- Latossolos (Cap 10)
  # -----------------------------------------------------------
  "L":
    - code: "LB"
      name: "Latossolos Brunos"
      tests:
        all_of:
          - latossolo_bruno: {}
    - code: "LA"
      name: "Latossolos Amarelos"
      tests:
        all_of:
          - latossolo_amarelo: {}
    - code: "LV"
      name: "Latossolos Vermelhos"
      tests:
        all_of:
          - latossolo_vermelho: {}
    - code: "LVA"
      name: "Latossolos Vermelho-Amarelos"
      tests:
        default: true
      notes: "Catch-all final dos Latossolos."

  # -----------------------------------------------------------
  # T -- Luvissolos (Cap 11)
  # -----------------------------------------------------------
  "T":
    - code: "TC"
      name: "Luvissolos Cromicos"
      tests:
        all_of:
          - luvissolo_cromico: {}
    - code: "TX"
      name: "Luvissolos Haplicos"
      tests:
        default: true
      notes: "Catch-all final dos Luvissolos."

  # -----------------------------------------------------------
  # R -- Neossolos (Cap 12)
  # -----------------------------------------------------------
  "R":
    - code: "RL"
      name: "Neossolos Litolicos"
      tests:
        all_of:
          - neossolo_litolico: {}
    - code: "RY"
      name: "Neossolos Fluvicos"
      tests:
        all_of:
          - neossolo_fluvico: {}
    - code: "RQ"
      name: "Neossolos Quartzarenicos"
      tests:
        all_of:
          - neossolo_quartzarenico: {}
    - code: "RR"
      name: "Neossolos Regoliticos"
      tests:
        default: true
      notes: "Catch-all final dos Neossolos."

  # -----------------------------------------------------------
  # N -- Nitossolos (Cap 13)
  # -----------------------------------------------------------
  "N":
    - code: "NB"
      name: "Nitossolos Brunos"
      tests:
        all_of:
          - nitossolo_bruno: {}
    - code: "NV"
      name: "Nitossolos Vermelhos"
      tests:
        all_of:
          - nitossolo_vermelho: {}
    - code: "NX"
      name: "Nitossolos Haplicos"
      tests:
        default: true
      notes: "Catch-all final dos Nitossolos."

  # -----------------------------------------------------------
  # O -- Organossolos (Cap 14)
  # -----------------------------------------------------------
  "O":
    - code: "OJ"
      name: "Organossolos Tiomorficos"
      tests:
        all_of:
          - organossolo_tiomorfico: {}
    - code: "OO"
      name: "Organossolos Folicos"
      tests:
        all_of:
          - organossolo_folico: {}
    - code: "OX"
      name: "Organossolos Haplicos"
      tests:
        default: true
      notes: "Catch-all final dos Organossolos."

  # -----------------------------------------------------------
  # S -- Planossolos (Cap 15)
  # -----------------------------------------------------------
  "S":
    - code: "SN"
      name: "Planossolos Natricos"
      tests:
        all_of:
          - planossolo_natrico: {}
    - code: "SX"
      name: "Planossolos Haplicos"
      tests:
        default: true
      notes: "Catch-all final dos Planossolos."

  # -----------------------------------------------------------
  # F -- Plintossolos (Cap 16)
  # -----------------------------------------------------------
  "F":
    - code: "FF"
      name: "Plintossolos Petricos"
      tests:
        all_of:
          - plintossolo_petrico: {}
    - code: "FT"
      name: "Plintossolos Argiluvicos"
      tests:
        all_of:
          - plintossolo_argiluvico: {}
    - code: "FX"
      name: "Plintossolos Haplicos"
      tests:
        default: true
      notes: "Catch-all final dos Plintossolos."

  # -----------------------------------------------------------
  # V -- Vertissolos (Cap 17)
  # -----------------------------------------------------------
  "V":
    - code: "VG"
      name: "Vertissolos Hidromorficos"
      tests:
        all_of:
          - vertissolo_hidromorfico: {}
    - code: "VE"
      name: "Vertissolos Ebanicos"
      tests:
        all_of:
          - vertissolo_ebanico: {}
    - code: "VX"
      name: "Vertissolos Haplicos"
      tests:
        default: true
      notes: "Catch-all final dos Vertissolos."
