# Ejemplo OSINT — tipos comunes en investigacion de entidades.
# Color como "#RRGGBB" (con o sin alpha "#RRGGBBAA").
# Shapes: campo `shape` ignorado — todos los nodos son circulo, salvo
# el tipo "Table" que es cuadrado (regla en types_registry.cpp::apply_types_yaml).
# Iconos: nombres ti-* mapeados en tabler_codepoint_by_name.
# Fields: schema por tipo, formato inline-map.
#   tipos: string | int | float | bool | date | url | enum
#   enum requiere `values: [...]`
#   `principal_field` (opcional) es el nombre del field que sirve de label
#   visible en el grafo; default = "name".

entities:
  - name: Person
    color: "#5B8DEF"
    icon: ti-user
    principal_field: name
    fields:
      - { name: name,        type: string, required: true }
      - { name: first_name,  type: string }
      - { name: last_name,   type: string }
      - { name: age,         type: int }
      - { name: nationality, type: string }
      - { name: birth_date,  type: date }
      - { name: gender,      type: enum, values: [male, female, other] }
      - { name: occupation,  type: string }

  - name: Email
    color: "#58CA8C"
    icon: ti-mail
    principal_field: address
    fields:
      - { name: address,  type: string, required: true }
      - { name: provider, type: string }
      - { name: verified, type: bool }

  - name: Domain
    color: "#F4B860"
    icon: ti-world
    principal_field: name
    fields:
      - { name: name,         type: string, required: true }
      - { name: registrar,    type: string }
      - { name: created_at,   type: date }
      - { name: expires_at,   type: date }

  - name: Phone
    color: "#E36AC0"
    icon: ti-phone
    principal_field: number
    fields:
      - { name: number,       type: string, required: true }
      - { name: country_code, type: string }
      - { name: kind,         type: enum, values: [mobile, landline, voip] }

  - name: Org
    color: "#C780E8"
    icon: ti-building
    principal_field: name
    fields:
      - { name: name,    type: string, required: true }
      - { name: country, type: string }
      - { name: kind,    type: enum, values: [company, ngo, gov, other] }
      - { name: website, type: url }

  - name: IBAN
    color: "#52CDF2"
    icon: ti-building-bank
    principal_field: iban
    fields:
      - { name: iban,        type: string, required: true }
      - { name: country,     type: string }
      - { name: bank_name,   type: string }

  - name: Account
    color: "#7FD3A0"
    icon: ti-id
    principal_field: handle
    fields:
      - { name: handle,    type: string, required: true }
      - { name: platform,  type: string }
      - { name: url,       type: url }
      - { name: verified,  type: bool }

  - name: Document
    color: "#C9C9C9"
    icon: ti-file
    principal_field: title
    fields:
      - { name: title,    type: string, required: true }
      - { name: url,      type: url }
      - { name: kind,     type: string }
      - { name: created,  type: date }

  - name: Address
    color: "#FFB870"
    icon: ti-map-pin
    principal_field: line1
    fields:
      - { name: line1,    type: string, required: true }
      - { name: city,     type: string }
      - { name: country,  type: string }
      - { name: postcode, type: string }

  # Url — unifica el viejo Url (solo metadata) y Webpage (cuerpo
  # cacheado). Tras fetch_webpage, los campos `*_path`, `status_code`,
  # `fetched_at`, `text_length`, etc. tienen valor; sin haber corrido
  # fetch siguen vacios pero el nodo sigue siendo un Url valido.
  - name: Url
    color: "#89E0FC"
    icon: ti-link
    principal_field: url
    fields:
      - { name: url,             type: url, required: true }
      - { name: title,           type: string }
      - { name: domain,          type: string }
      - { name: status_code,     type: int }
      - { name: content_type,    type: string }
      - { name: fetched_at,      type: date }
      - { name: html_path,       type: string }
      - { name: markdown_path,   type: string }
      - { name: screenshot_path, type: string }
      - { name: text_length,     type: int }
      - { name: lang,            type: string }

  # Sentence — fragmento de texto producido por split_sentences. Color
  # violeta para distinguirlo de Text/Document; principal_field=text para
  # que el viewport muestre el contenido completo en el inspector.
  - name: Sentence
    color: "#A78BFA"
    icon: ti-quote
    principal_field: text
    fields:
      - { name: text,     type: string, required: true }
      - { name: rank,     type: int }
      - { name: batch_id, type: string }

  # Word — token emitido por split_words. Pensado para probar grouping
  # con volumen alto: cualquier parrafo decente supera el umbral de 50
  # tokens trivialmente. Color amarillo para distinguir de Sentence.
  - name: Word
    color: "#FCD34D"
    icon: ti-letter-w
    principal_field: word
    fields:
      - { name: word,     type: string, required: true }
      - { name: rank,     type: int }
      - { name: batch_id, type: string }

  # Nodo grupo — cuadrado (regla de forma). Issue 0035: contenedor para
  # agrupar resultados de enrichers cuando exceden el umbral. Los hijos
  # son entidades reales con `group_id` apuntando al Group.
  - name: Group
    color: "#94A3B8"
    icon: ti-stack-2
    shape: square
    principal_field: name
    fields:
      - { name: name,     type: string, required: true }
      - { name: count,    type: int }
      - { name: enricher, type: string }
      - { name: batch_id, type: string }

  # Nodo tabla — cuadrado (regla de forma). Issue 0010: contenedor con
  # filas que son nodos del grafo.
  - name: Table
    color: "#0EA5E9"
    icon: ti-database
    principal_field: name
    fields:
      - { name: name,     type: string, required: true }
      - { name: row_type, type: string }
      - { name: columns,  type: string }
      - { name: expanded, type: bool }

relations:
  - name: owns
    color: "#888888"
    style: solid

  - name: knows
    color: "#AAAAAA"
    style: solid

  - name: located_in
    color: "#FFB870"
    style: dashed

  - name: transfers_to
    color: "#52CDF2"
    style: dotted

  - name: member_of
    color: "#C780E8"
    style: dashed

  # Pertenencia de fila a tabla (issue 0010).
  - name: CONTAINS_ROW
    color: "#0EA5E9"
    style: dotted
