{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/getoneprofile-ai/json-schema/getoneprofile-ai-account-header-read-schema-schema.json",
  "title": "AccountHeaderReadSchema",
  "description": "The line under an account's name: the latest reply, who is in a sequence, the roles.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/getoneprofile-ai-accounts-api-openapi.yml#/components/schemas/AccountHeaderReadSchema",
  "properties": {
    "account_key": {
      "description": "The account's key, after any merge.",
      "title": "Account Key",
      "type": "string"
    },
    "crm": {
      "anyOf": [
        {
          "$ref": "#/$defs/AccountCrmRecordReadSchema"
        },
        {
          "type": "null"
        }
      ],
      "description": "Its own company record in a connected CRM (the CRM table imported first, its newest row): the link and the owner. Null when no CRM record is on it."
    },
    "in_sequence_count": {
      "description": "People here live in a sequence now.",
      "title": "In Sequence Count",
      "type": "integer"
    },
    "latest_reply": {
      "anyOf": [
        {
          "$ref": "#/$defs/AccountHeaderPersonReadSchema"
        },
        {
          "type": "null"
        }
      ],
      "description": "Who wrote back last, on any channel; null when nobody here ever did."
    },
    "latest_reply_at": {
      "anyOf": [
        {
          "format": "date-time",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "When their newest message came.",
      "title": "Latest Reply At"
    },
    "name": {
      "title": "Name",
      "type": "string"
    },
    "roles": {
      "description": "Each role a rep gave a person on the org chart, in the role menu's order.",
      "items": {
        "$ref": "#/$defs/AccountHeaderRoleReadSchema"
      },
      "title": "Roles",
      "type": "array"
    }
  },
  "required": [
    "account_key",
    "name",
    "latest_reply",
    "latest_reply_at",
    "in_sequence_count",
    "roles"
  ],
  "type": "object",
  "$defs": {
    "AccountCrmRecordReadSchema": {
      "description": "The account's own company record in a connected CRM: its link and its owner.",
      "properties": {
        "has_owner": {
          "description": "Whether the record names an owner.",
          "title": "Has Owner",
          "type": "boolean"
        },
        "owner_email": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Owner Email"
        },
        "owner_name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "description": "The owner, once the CRM said who that is.",
          "title": "Owner Name"
        },
        "record_id": {
          "description": "Its row in that table.",
          "format": "uuid",
          "title": "Record Id",
          "type": "string"
        },
        "table_id": {
          "description": "The table the record was imported into.",
          "format": "uuid",
          "title": "Table Id",
          "type": "string"
        },
        "tool_name": {
          "description": "The CRM, as the integrations page names it.",
          "title": "Tool Name",
          "type": "string"
        },
        "url": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "description": "The record in the CRM; null until an import saved what links are built from.",
          "title": "Url"
        }
      },
      "required": [
        "table_id",
        "record_id",
        "tool_name",
        "url",
        "has_owner",
        "owner_name",
        "owner_email"
      ],
      "title": "AccountCrmRecordReadSchema",
      "type": "object"
    },
    "AccountHeaderPersonReadSchema": {
      "description": "One person the header names.",
      "properties": {
        "id": {
          "description": "Their person id, as the People tab and org chart name them.",
          "format": "uuid",
          "title": "Id",
          "type": "string"
        },
        "name": {
          "description": "Their name, else their address, else their key.",
          "title": "Name",
          "type": "string"
        }
      },
      "required": [
        "id",
        "name"
      ],
      "title": "AccountHeaderPersonReadSchema",
      "type": "object"
    },
    "AccountHeaderRoleReadSchema": {
      "description": "One part a rep gave a person in the deal.",
      "properties": {
        "person": {
          "$ref": "#/$defs/AccountHeaderPersonReadSchema"
        },
        "role": {
          "$ref": "#/$defs/AccountPersonRole"
        }
      },
      "required": [
        "role",
        "person"
      ],
      "title": "AccountHeaderRoleReadSchema",
      "type": "object"
    },
    "AccountPersonRole": {
      "description": "The part a rep says a person plays in a deal. None: not known.",
      "enum": [
        "champion",
        "budget_holder",
        "decision_maker",
        "influencer",
        "user",
        "blocker"
      ],
      "title": "AccountPersonRole",
      "type": "string"
    }
  }
}