$schema: https://json-schema.org/draft/2020-12/schema
$id: Identifier.yaml
type: object
properties:
  registry:
    type: object
    properties:
      code:
        type: string
        description: Canonical CommonGrants registry code, `<schema>:<scope>:<prop>` (e.g. `org:us:ein`).
      url:
        type: string
        format: uri
        description: Link to the catalog entry for this registry.
    unevaluatedProperties:
      not: {}
    description: Registry-level facts shared by every record in this registry.
  id:
    type: string
    description: |-
      The primary identifier string, when the registry has a single canonical value.

      May be omitted for registries with no natural primary; consumers should read
      `allIds` in that case.
  allIds:
    type: array
    items:
      type: object
      properties:
        id:
          type: string
          description: The identifier string.
        status:
          $ref: IdentifierStatus.yaml
          description: Whether the identifier is currently valid or retired.
      required:
        - id
        - status
      unevaluatedProperties:
        not: {}
    description: Every known identifier for this record in this registry, including archived values.
unevaluatedProperties:
  not: {}
examples:
  - registry:
      code: org:us:ein
      url: https://commongrants.org/registries/org-us-ein
    id: "123456789"
    allIds:
      - id: "123456789"
        status: active
      - id: "987654321"
        status: archived
  - registry:
      code: org:us:ein
      url: https://commongrants.org/registries/org-us-ein
    id: "123456789"
description: |-
  An identifier issued to a record by a registry.

  Accepts any string value and any registry code. Model-specific collections use
  registry-typed instantiations of `IdentifierT` (e.g. `OrgIdEin`) for their base
  identifiers, and this generic form for extension identifiers under `otherIds`.
