{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/peerbound/json-schema/peerbound-story-schema.json",
  "title": "Story",
  "description": "A published customer story.",
  "x-generated": "2026-11-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/peerbound-stories-api-openapi.yml#/components/schemas/Story",
  "properties": {
    "id": {
      "type": "string",
      "title": "Id",
      "description": "Unique Peerbound identifier"
    },
    "title": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Title",
      "description": "Published title of the story"
    },
    "approval_state": {
      "type": "string",
      "enum": [
        "Not Approved",
        "Approved – Public"
      ],
      "title": "Approval State",
      "description": "Current approval state"
    },
    "links": {
      "$ref": "#/$defs/StoryLinks",
      "description": "URLs for accessing the story content"
    },
    "account": {
      "anyOf": [
        {
          "$ref": "#/$defs/LinkedAccount"
        },
        {
          "type": "null"
        }
      ],
      "description": "Associated account (customer)"
    },
    "approved_on": {
      "type": "string",
      "title": "Approved On",
      "description": "Date when the story was approved (ISO 8601 date)"
    },
    "is_deleted": {
      "type": "boolean",
      "title": "Is Deleted",
      "description": "Whether the story has been deleted"
    },
    "created_at": {
      "type": "string",
      "title": "Created At",
      "description": "Timestamp when the story was created (ISO 8601)"
    },
    "updated_at": {
      "type": "string",
      "title": "Updated At",
      "description": "Timestamp when the story was last updated (ISO 8601)"
    }
  },
  "type": "object",
  "required": [
    "id",
    "approval_state",
    "links",
    "approved_on",
    "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."
    },
    "StoryLinks": {
      "properties": {
        "pdf_url": {
          "type": "string",
          "title": "Pdf Url",
          "description": "URL to the story PDF"
        },
        "web_link_url": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Web Link Url",
          "description": "URL to the story landing page"
        },
        "slide_deck_url": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Slide Deck Url",
          "description": "URL to slide deck version"
        },
        "sales_content_url": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Sales Content Url",
          "description": "URL to sales enablement content"
        }
      },
      "type": "object",
      "required": [
        "pdf_url"
      ],
      "title": "StoryLinks",
      "description": "Links associated with a story."
    }
  }
}