{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/pollunit-com/json-schema/pollunit-com-vote-schema.json",
  "title": "Vote",
  "description": "A vote of one participant for one option. Which value field is set depends on the poll's `vote_type`.",
  "x-generated": "2026-11-21",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/pollunit-com-openapi.yml#/components/schemas/Vote",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Vote id"
    },
    "type": {
      "type": "string"
    },
    "created_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "updated_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "option_id": {
      "type": [
        "string",
        "null"
      ],
      "description": "Option public_id. For pairwise comparisons the option that won the comparison."
    },
    "loser_option_id": {
      "type": [
        "string",
        "null"
      ],
      "description": "Pairwise comparisons only: option public_id of the option that lost the comparison."
    },
    "voter_id": {
      "type": [
        "string",
        "null"
      ],
      "description": "Voter public_id"
    },
    "vote": {
      "anyOf": [
        {
          "type": [
            "number",
            "null"
          ]
        },
        {
          "type": [
            "string",
            "null"
          ]
        }
      ],
      "description": "The value of the vote, whichever of `vote`, `vote_date`, `vote_text` or the decimal value is set."
    },
    "vote_date": {
      "type": [
        "string",
        "null"
      ],
      "format": "date",
      "description": "Day the vote was cast on, for polls with `vote_per_day`."
    },
    "vote_text": {
      "type": [
        "string",
        "null"
      ],
      "description": "Value of text votes, e.g. table columns."
    },
    "paid": {
      "type": [
        "boolean",
        "null"
      ],
      "description": "Admin access only, and only for polls with a voting wallet. `false` while bought votes are not paid yet."
    },
    "voting_category_id": {
      "type": [
        "integer",
        "null"
      ],
      "description": "Only for polls with `voting_categories`."
    }
  },
  "required": [
    "id",
    "type"
  ]
}