{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/getoneprofile-ai/json-schema/getoneprofile-ai-account-source-read-schema-schema.json",
  "title": "AccountSourceReadSchema",
  "description": "One table's standing on the Accounts page, and why.",
  "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/AccountSourceReadSchema",
  "properties": {
    "account_count": {
      "description": "The accounts its rows sit on, at the last index.",
      "title": "Account Count",
      "type": "integer"
    },
    "awaits_index": {
      "description": "Whether an index of the table is on its way: it was looked at and is not indexed yet, in a workspace whose Accounts were opened. Its counts arrive when this turns false; false in a workspace that never opened Accounts, where nothing indexes it.",
      "title": "Awaits Index",
      "type": "boolean"
    },
    "candidates": {
      "description": "The columns a person may choose as the company column: the two that disagree when two website columns do, otherwise the one chosen, the columns that read as a website, a company LinkedIn page or a work email, then every other text, link or address column that is not a name, a profile, a manager or a company fact such as Industry.",
      "items": {
        "$ref": "#/$defs/AccountSourceCandidateReadSchema"
      },
      "title": "Candidates",
      "type": "array"
    },
    "columns": {
      "description": "The columns its rows are read through, and why each.",
      "items": {
        "$ref": "#/$defs/AccountSourceColumnReadSchema"
      },
      "title": "Columns",
      "type": "array"
    },
    "company_column_id": {
      "anyOf": [
        {
          "format": "uuid",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Company Column Id"
    },
    "indexed_at": {
      "anyOf": [
        {
          "format": "date-time",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "When it was last indexed; None before then.",
      "title": "Indexed At"
    },
    "left_off": {
      "description": "Its rows on no account at the last index, by what they lack (`company_name_only`: a company name but no website, company page or work address; `personal_email`: only a personal address such as Gmail; `no_company`: nothing that names a company), each with the first such row; its rows number `row_count` plus these. Empty before an index counted them.",
      "items": {
        "$ref": "#/$defs/AccountLeftOffReadSchema"
      },
      "title": "Left Off",
      "type": "array"
    },
    "manager_candidates": {
      "description": "Columns that may hold each person's manager, by their label, for a person to pick as the manager column.",
      "items": {
        "$ref": "#/$defs/AccountSourceCandidateReadSchema"
      },
      "title": "Manager Candidates",
      "type": "array"
    },
    "manager_column_id": {
      "anyOf": [
        {
          "format": "uuid",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Manager Column Id"
    },
    "manager_options": {
      "description": "Every column a person may pick as a people table's manager column: the suggested ones first, then each other column that could name a person (never the row's own name, title, profile, address or company, a website, a company fact, the Person researcher's or a column a sequence or an export writes), and the one chosen. A company table offers only the one chosen.",
      "items": {
        "$ref": "#/$defs/AccountSourceCandidateReadSchema"
      },
      "title": "Manager Options",
      "type": "array"
    },
    "reason": {
      "anyOf": [
        {
          "$ref": "#/$defs/AccountLinkReason"
        },
        {
          "type": "null"
        }
      ],
      "description": "Why the table is not linked, if not."
    },
    "row_count": {
      "description": "Its rows on an account, at the last index.",
      "title": "Row Count",
      "type": "integer"
    },
    "row_kind": {
      "$ref": "#/$defs/AccountRowKind"
    },
    "show_on_accounts": {
      "title": "Show On Accounts",
      "type": "boolean"
    },
    "sole_account_key": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "The one account its rows are on, when `account_count` is 1; read by `GET /accounts/sources/{table_id}/` alone, null in the list.",
      "title": "Sole Account Key"
    },
    "status": {
      "$ref": "#/$defs/AccountLinkStatus"
    },
    "table_id": {
      "format": "uuid",
      "title": "Table Id",
      "type": "string"
    },
    "table_name": {
      "title": "Table Name",
      "type": "string"
    }
  },
  "required": [
    "table_id",
    "table_name",
    "status",
    "reason",
    "row_kind",
    "columns",
    "candidates",
    "manager_candidates",
    "manager_options",
    "show_on_accounts",
    "company_column_id",
    "manager_column_id",
    "row_count",
    "account_count",
    "left_off",
    "indexed_at",
    "awaits_index"
  ],
  "type": "object",
  "$defs": {
    "AccountColumnEvidence": {
      "description": "How a column's role was known, strongest first.\n\nA lead search's own columns and a person's choice are known for certain; an\nenrichment's outputs are what the catalog declares; values are read from a\nsample of the column's cells; a label is used for display columns only.",
      "enum": [
        "chosen",
        "structural",
        "enrichment",
        "values",
        "label"
      ],
      "title": "AccountColumnEvidence",
      "type": "string"
    },
    "AccountColumnRole": {
      "description": "What a column of a linked table is read as.",
      "enum": [
        "website",
        "company_page",
        "email",
        "profile",
        "name",
        "first_name",
        "last_name",
        "title",
        "company_name",
        "manager"
      ],
      "title": "AccountColumnRole",
      "type": "string"
    },
    "AccountLeftOffReadSchema": {
      "description": "A linked table's rows on no account for one reason (review AC-20).",
      "properties": {
        "reason": {
          "$ref": "#/$defs/AccountLeftOffReason"
        },
        "record_id": {
          "description": "The first of them, for a link to it in its table.",
          "format": "uuid",
          "title": "Record Id",
          "type": "string"
        },
        "row_count": {
          "description": "How many rows.",
          "title": "Row Count",
          "type": "integer"
        }
      },
      "required": [
        "reason",
        "row_count",
        "record_id"
      ],
      "title": "AccountLeftOffReadSchema",
      "type": "object"
    },
    "AccountLeftOffReason": {
      "description": "Why a row of a linked table is on no account, in words Sources and the table badge print.\n\nA fixed rule, read off the cells the decision reads (review AC-20: a Gmail\nrow was dropped silently, and the badge said only \"On 1 account\").",
      "enum": [
        "company_name_only",
        "personal_email",
        "no_company"
      ],
      "title": "AccountLeftOffReason",
      "type": "string"
    },
    "AccountLinkReason": {
      "description": "Why a table is not linked, in words the Sources panel and the table badge print.\n\nA linked table carries no reason. Archived tables stay linked (Utku,\n2026-11-01): archiving tidies the Tables list, it does not retire the data.",
      "enum": [
        "no_company_column",
        "two_company_columns",
        "turned_off"
      ],
      "title": "AccountLinkReason",
      "type": "string"
    },
    "AccountLinkStatus": {
      "description": "Whether a table's rows feed the Accounts page.",
      "enum": [
        "linked",
        "not_linked"
      ],
      "title": "AccountLinkStatus",
      "type": "string"
    },
    "AccountRowKind": {
      "description": "What one row of a linked table stands for on an account: the company, or a person there.",
      "enum": [
        "company",
        "person"
      ],
      "title": "AccountRowKind",
      "type": "string"
    },
    "AccountSourceCandidateReadSchema": {
      "description": "A company column a person is asked to choose, when two disagree.",
      "properties": {
        "column_id": {
          "format": "uuid",
          "title": "Column Id",
          "type": "string"
        },
        "column_name": {
          "title": "Column Name",
          "type": "string"
        }
      },
      "required": [
        "column_id",
        "column_name"
      ],
      "title": "AccountSourceCandidateReadSchema",
      "type": "object"
    },
    "AccountSourceColumnReadSchema": {
      "properties": {
        "column_id": {
          "format": "uuid",
          "title": "Column Id",
          "type": "string"
        },
        "column_name": {
          "title": "Column Name",
          "type": "string"
        },
        "evidence": {
          "$ref": "#/$defs/AccountColumnEvidence",
          "description": "Why: a person chose it, a search or formula made it, an enrichment promoted it, its values read that way, or its label."
        },
        "role": {
          "$ref": "#/$defs/AccountColumnRole"
        }
      },
      "required": [
        "column_id",
        "column_name",
        "role",
        "evidence"
      ],
      "title": "AccountSourceColumnReadSchema",
      "type": "object"
    }
  }
}