{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/peerbound/json-schema/peerbound-note-schema.json",
  "title": "Note",
  "description": "A note associated with an account and optionally a contact.\n\nNotes include the type name normalized as a string. The updated_at\nreflects changes to both the note and its associated note type.",
  "x-generated": "2026-11-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/peerbound-notes-api-openapi.yml#/components/schemas/Note",
  "properties": {
    "id": {
      "type": "string",
      "title": "Id",
      "description": "Unique Peerbound identifier for the note"
    },
    "text": {
      "type": "string",
      "title": "Text",
      "description": "The note content"
    },
    "note_type": {
      "type": "string",
      "title": "Note Type",
      "description": "Type/category of the note"
    },
    "date": {
      "type": "string",
      "title": "Date",
      "description": "Date the note is associated with (ISO 8601 date)"
    },
    "source_link_url": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Source Link Url",
      "description": "External URL reference for the note"
    },
    "account": {
      "anyOf": [
        {
          "$ref": "#/$defs/LinkedAccount"
        },
        {
          "type": "null"
        }
      ],
      "description": "Associated account (customer)"
    },
    "contact": {
      "anyOf": [
        {
          "$ref": "#/$defs/LinkedContact"
        },
        {
          "type": "null"
        }
      ],
      "description": "Associated contact (person)"
    },
    "is_deleted": {
      "type": "boolean",
      "title": "Is Deleted",
      "description": "Whether the note has been deleted"
    },
    "created_at": {
      "type": "string",
      "title": "Created At",
      "description": "Timestamp when the note was created (ISO 8601)"
    },
    "updated_at": {
      "type": "string",
      "title": "Updated At",
      "description": "Timestamp when the note or its type was last updated (ISO 8601)"
    }
  },
  "type": "object",
  "required": [
    "id",
    "text",
    "note_type",
    "date",
    "is_deleted",
    "created_at",
    "updated_at"
  ],
  "$defs": {
    "LinkedAccount": {
      "properties": {
        "id": {
          "type": "string",
          "title": "Id",
          "description": "Unique Peerbound identifier for the account"
        },
        "name": {
          "type": "string",
          "title": "Name",
          "description": "Name of the account"
        },
        "salesforce_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Salesforce Id",
          "description": "Salesforce Account ID if synced"
        },
        "hubspot_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Hubspot Id",
          "description": "HubSpot Company ID if synced"
        }
      },
      "type": "object",
      "required": [
        "id",
        "name"
      ],
      "title": "LinkedAccount",
      "description": "Account (customer company) linked to a resource.\n\nUsed for stories, reviews, and moments to reference the associated account."
    },
    "LinkedContact": {
      "properties": {
        "id": {
          "type": "string",
          "title": "Id",
          "description": "Unique Peerbound identifier for the contact"
        },
        "name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Name",
          "description": "Full name of the contact"
        },
        "email": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Email",
          "description": "Email address of the contact"
        },
        "salesforce_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Salesforce Id",
          "description": "Salesforce Contact ID if synced"
        },
        "hubspot_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Hubspot Id",
          "description": "HubSpot Contact ID if synced"
        }
      },
      "type": "object",
      "required": [
        "id"
      ],
      "title": "LinkedContact",
      "description": "Contact (person) linked to a resource.\n\nUsed for reviews and moments to reference the associated contact."
    }
  }
}