{
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "$id": "https://tipifica.org/dados/schema/tipologias.schema.json",
 "title": "Tipifica · tipologias",
 "description": "Arquivo dados/tipologias.json do Tipifica (inferido dos registros publicados).",
 "type": "object",
 "required": [
  "entidade",
  "n",
  "registros"
 ],
 "properties": {
  "entidade": {
   "const": "tipologias"
  },
  "n": {
   "type": "integer"
  },
  "registros": {
   "type": "array",
   "items": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string"
     },
     "slug": {
      "type": "string"
     },
     "nome": {
      "type": "string"
     },
     "nivel": {
      "type": "string"
     },
     "definicao": {
      "type": "string"
     },
     "funcoes": {
      "type": "array",
      "items": {
       "type": "string"
      }
     },
     "finalidades": {
      "type": "array",
      "items": {
       "type": "string"
      }
     },
     "papeis": {
      "type": "array",
      "items": {
       "type": "object",
       "properties": {
        "papel": {
         "type": "string"
        },
        "objetivo": {
         "type": "string"
        },
        "ganho": {},
        "risco": {
         "type": "string"
        },
        "obrigatorio": {
         "type": "boolean"
        }
       },
       "required": [
        "papel",
        "objetivo",
        "ganho",
        "risco",
        "obrigatorio"
       ]
      }
     },
     "pre_condicoes": {
      "type": "array",
      "items": {
       "type": "string"
      }
     },
     "tecnicas_minimas": {
      "type": "array",
      "items": {
       "type": "object",
       "properties": {
        "uma_de": {
         "type": "array",
         "items": {
          "type": "string"
         }
        }
       },
       "required": [
        "uma_de"
       ]
      }
     },
     "compoe": {
      "type": "array",
      "items": {
       "type": "string"
      }
     },
     "vinculos": {
      "type": "array",
      "items": {
       "type": "object",
       "properties": {
        "id": {
         "type": "string"
        },
        "a": {
         "type": "string"
        },
        "b": {
         "type": "string"
        },
        "tipo": {
         "type": "string"
        },
        "o_que_garante": {
         "type": "string"
        },
        "obrigatorio": {
         "type": "boolean"
        }
       },
       "required": [
        "id",
        "a",
        "b",
        "tipo",
        "o_que_garante",
        "obrigatorio"
       ]
      }
     },
     "antecedentes": {
      "type": "array",
      "items": {
       "type": "string"
      }
     },
     "estado_catalogo": {
      "type": "string"
     },
     "vigencia": {},
     "passos": {
      "type": "array",
      "items": {
       "type": "object",
       "properties": {
        "id": {
         "type": "string"
        },
        "ordem": {
         "type": "integer"
        },
        "nome": {
         "type": "string"
        },
        "descricao": {
         "type": "string"
        },
        "tecnica": {
         "type": "string"
        },
        "opcional": {
         "type": "boolean"
        },
        "recorrente": {
         "type": "boolean"
        },
        "depende_de": {
         "type": "array",
         "items": {
          "type": "string"
         }
        },
        "alternativas": {
         "type": "array",
         "items": {
          "type": "string"
         }
        },
        "papeis_que_agem": {
         "type": "array",
         "items": {
          "type": "string"
         }
        },
        "natureza_do_fluxo": {
         "type": "string"
        },
        "ativos": {
         "type": "array",
         "items": {
          "type": "string"
         }
        },
        "canais": {
         "type": "array",
         "items": {
          "type": "object",
          "properties": {
           "licenca": {
            "type": "string"
           },
           "posicao": {
            "type": "string"
           }
          },
          "required": [
           "licenca",
           "posicao"
          ]
         }
        },
        "estruturas": {
         "type": "array",
         "items": {
          "type": "string"
         }
        },
        "produtos": {
         "type": "array",
         "items": {
          "type": "string"
         }
        },
        "trilhos": {
         "type": "array",
         "items": {
          "type": "string"
         }
        },
        "jurisdicao": {
         "type": "string"
        },
        "fluxos": {
         "type": "array",
         "items": {
          "type": "object",
          "properties": {
           "de": {
            "type": "string"
           },
           "para": {
            "type": "string"
           },
           "rotulo": {
            "type": "string"
           },
           "natureza": {
            "type": "string"
           },
           "retorno": {
            "type": "boolean"
           }
          },
          "required": [
           "de",
           "para",
           "rotulo",
           "natureza"
          ]
         }
        }
       },
       "required": [
        "id",
        "ordem",
        "nome",
        "descricao",
        "tecnica",
        "opcional",
        "recorrente",
        "depende_de",
        "alternativas",
        "papeis_que_agem",
        "natureza_do_fluxo",
        "ativos",
        "canais",
        "estruturas",
        "produtos",
        "trilhos",
        "jurisdicao"
       ]
      }
     },
     "variacoes": {
      "type": "array",
      "items": {
       "type": "object",
       "properties": {
        "id": {
         "type": "string"
        },
        "nome": {
         "type": "string"
        },
        "descricao": {
         "type": "string"
        },
        "base": {
         "type": "boolean"
        },
        "tipologia": {
         "type": "string"
        },
        "estado_catalogo": {
         "type": "string"
        },
        "paises": {
         "type": "array",
         "items": {}
        },
        "passos_adicionados": {
         "type": "array",
         "items": {
          "type": "object",
          "properties": {
           "id": {
            "type": "string"
           },
           "ordem": {
            "type": "integer"
           },
           "nome": {
            "type": "string"
           },
           "descricao": {
            "type": "string"
           },
           "tecnica": {
            "type": "string"
           },
           "opcional": {
            "type": "boolean"
           },
           "recorrente": {
            "type": "boolean"
           },
           "depende_de": {
            "type": "array",
            "items": {
             "type": "string"
            }
           },
           "alternativas": {
            "type": "array",
            "items": {}
           },
           "papeis_que_agem": {
            "type": "array",
            "items": {
             "type": "string"
            }
           },
           "natureza_do_fluxo": {
            "type": "string"
           },
           "ativos": {
            "type": "array",
            "items": {
             "type": "string"
            }
           },
           "canais": {
            "type": "array",
            "items": {
             "type": "object",
             "properties": {
              "licenca": {
               "type": "string"
              },
              "posicao": {
               "type": "string"
              }
             },
             "required": [
              "licenca",
              "posicao"
             ]
            }
           },
           "estruturas": {
            "type": "array",
            "items": {
             "type": "string"
            }
           },
           "produtos": {
            "type": "array",
            "items": {
             "type": "string"
            }
           },
           "trilhos": {
            "type": "array",
            "items": {}
           },
           "jurisdicao": {
            "type": "string"
           },
           "fluxos": {
            "type": "array",
            "items": {
             "type": "object",
             "properties": {
              "de": {
               "type": "string"
              },
              "para": {
               "type": "string"
              },
              "rotulo": {
               "type": "string"
              },
              "natureza": {
               "type": "string"
              }
             },
             "required": [
              "de",
              "para",
              "rotulo",
              "natureza"
             ]
            }
           }
          },
          "required": [
           "id",
           "ordem",
           "nome",
           "descricao",
           "tecnica",
           "opcional",
           "recorrente",
           "depende_de",
           "alternativas",
           "papeis_que_agem",
           "natureza_do_fluxo",
           "ativos",
           "canais",
           "estruturas",
           "produtos",
           "trilhos",
           "jurisdicao",
           "fluxos"
          ]
         }
        },
        "passos_alterados": {
         "type": "array",
         "items": {
          "type": "object",
          "properties": {
           "passo": {
            "type": "string"
           },
           "acrescenta": {
            "type": "object",
            "properties": {
             "papeis_que_agem": {
              "type": "array",
              "items": {
               "type": "string"
              }
             },
             "fluxos": {
              "type": "array",
              "items": {
               "type": "object",
               "properties": {
                "de": {
                 "type": "string"
                },
                "para": {
                 "type": "string"
                },
                "rotulo": {
                 "type": "string"
                },
                "natureza": {
                 "type": "string"
                }
               },
               "required": [
                "de",
                "para",
                "rotulo",
                "natureza"
               ]
              }
             },
             "ativos": {
              "type": "array",
              "items": {
               "type": "string"
              }
             },
             "trilhos": {
              "type": "array",
              "items": {
               "type": "string"
              }
             },
             "produtos": {
              "type": "array",
              "items": {
               "type": "string"
              }
             },
             "estruturas": {
              "type": "array",
              "items": {
               "type": "string"
              }
             },
             "canais": {
              "type": "array",
              "items": {
               "type": "object",
               "properties": {
                "licenca": {
                 "type": "string"
                },
                "posicao": {
                 "type": "string"
                }
               },
               "required": [
                "licenca",
                "posicao"
               ]
              }
             }
            }
           },
           "remove": {
            "type": "object",
            "properties": {}
           },
           "substitui_tecnica": {
            "type": "string"
           }
          },
          "required": [
           "passo",
           "acrescenta",
           "remove",
           "substitui_tecnica"
          ]
         }
        },
        "passos_removidos": {
         "type": "array",
         "items": {}
        },
        "vigencia": {}
       },
       "required": [
        "id",
        "nome",
        "descricao",
        "base",
        "tipologia",
        "estado_catalogo",
        "paises",
        "passos_adicionados",
        "passos_alterados",
        "passos_removidos",
        "vigencia"
       ]
      }
     }
    },
    "required": [
     "id",
     "slug",
     "nome",
     "nivel",
     "finalidades",
     "estado_catalogo",
     "passos",
     "variacoes"
    ]
   }
  }
 }
}