{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://docs.demiton.io/registers/portal_document/v2.json",
  "title": "portal_document contract v2",
  "type": "object",
  "required": [
    "external_id",
    "fact_class",
    "financial_period",
    "name",
    "occurred_at",
    "sha256",
    "size_bytes",
    "source_portal"
  ],
  "properties": {
    "name": {
      "type": "string",
      "description": "The file name as the portal listed it.",
      "x-demiton-requiredness": "required"
    },
    "sha256": {
      "type": "string",
      "description": "Content fingerprint of the fetched bytes; the integrity claim about a file whose bytes are not kept.",
      "x-demiton-requiredness": "required"
    },
    "content": {
      "type": "string",
      "description": "One generated sentence: \"Portal document {name} fetched by estimating/portal_fetch (agent run {id}).\" The searchable prose half.",
      "x-demiton-requiredness": "optional"
    },
    "project": {
      "type": "string",
      "description": "Declared `PROJECT` axis; populated only when the opportunity resolves to a project.",
      "x-demiton-requiredness": "optional",
      "x-demiton-reference": true
    },
    "fact_class": {
      "type": "string",
      "description": "Provenance class: an agent's metadata capture of a downloaded file, not a value the source system reported.",
      "x-demiton-requiredness": "required"
    },
    "size_bytes": {
      "type": "integer",
      "description": "Size of the fetched bytes at download time.",
      "x-demiton-requiredness": "required",
      "x-demiton-unit": "bytes"
    },
    "external_id": {
      "type": "string",
      "description": "Identity of the fetched document: `{portal}:{document_id}`. Maps to `Fact.source_id`.",
      "x-demiton-requiredness": "required"
    },
    "occurred_at": {
      "type": "string",
      "description": "The download time, stamped at write; the event key of an episodic fact and the source `FINANCIAL_PERIOD` derives from.",
      "x-demiton-requiredness": "required",
      "format": "date-time",
      "x-demiton-type": "datetime"
    },
    "agent_run_id": {
      "type": "number",
      "description": "The `AgentRun` that performed the fetch; also the fact's `citation.origin_uri` (`demiton://agent/portal_fetch/run/{id}`).",
      "x-demiton-requiredness": "optional"
    },
    "source_portal": {
      "type": "string",
      "description": "Which portal the document came from; defaults to the literal `\"portal\"` when the artifact omits it.",
      "x-demiton-requiredness": "required"
    },
    "opportunity_ref": {
      "type": "string",
      "description": "The opportunity the fetch was for, from the agent goal; a reference, not a resolved entity.",
      "x-demiton-requiredness": "optional"
    },
    "financial_period": {
      "type": "string",
      "description": "Declared `FINANCIAL_PERIOD` axis; resolved from `occurred_at` when the writer passes no coordinate.",
      "x-demiton-requiredness": "required",
      "format": "date",
      "x-demiton-type": "date"
    }
  },
  "x-demiton-register-type": "portal_document",
  "x-demiton-contract-version": "2.0.2",
  "x-demiton-store": "tenant",
  "x-demiton-axes": [
    {
      "axis": "project",
      "requirement": "optional",
      "role": "subject"
    },
    {
      "axis": "financial_period",
      "requirement": "required",
      "role": "context"
    }
  ],
  "x-demiton-measures": [],
  "x-demiton-provenance": {
    "standards": [
      {
        "code": "AS ISO 19650.1:2019 / AS ISO 19650.2:2019",
        "title": "Organization and digitization of information about buildings and civil engineering works, including BIM - Information management using BIM - Part 1: Concepts and principles",
        "access": "public_summary",
        "region": "Australia",
        "edition": "2019",
        "checked_on": "2026-09-14"
      },
      {
        "code": "AS ISO 19650.2:2019",
        "title": "Information management using BIM - Part 2: Delivery phase of the assets",
        "access": "public_summary",
        "region": "Australia",
        "edition": "2019",
        "checked_on": "2026-09-14"
      },
      {
        "code": "ISO 19650-1:2018 / ISO 19650-2:2018",
        "title": "Information management using building information modelling - Part 1: Concepts and principles",
        "access": "public_summary",
        "region": "International",
        "edition": "2018",
        "checked_on": "2026-09-14"
      },
      {
        "code": "ISO 19650-2:2018",
        "title": "Information management using building information modelling - Part 2: Delivery phase of the assets",
        "access": "public_summary",
        "region": "International",
        "edition": "2018",
        "checked_on": "2026-09-14"
      }
    ]
  },
  "description": "Documents downloaded from a client or tender portal, by project.",
  "x-demiton-contract-url": "https://docs.demiton.io/registers/portal_document/",
  "x-demiton-register-catalog": "https://docs.demiton.io/concepts/register-catalog"
}