{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/yentaknows-ai/json-schema/yentaknows-ai-venue-schema.json",
  "title": "Venue",
  "description": "A published venue as the directory presents it.",
  "x-generated": "2026-11-29",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/dev-openapi.json#/components/schemas/Venue",
  "type": "object",
  "properties": {
    "slug": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "city": {
      "type": "string"
    },
    "country": {
      "type": "string"
    },
    "currency": {
      "type": "string"
    },
    "description": {
      "type": "string"
    },
    "latitude": {
      "type": "string",
      "description": "Decimal degrees as an exact string (not a float), when stated."
    },
    "longitude": {
      "type": "string",
      "description": "Decimal degrees as an exact string (not a float), when stated."
    },
    "phone": {
      "type": "string",
      "description": "The venue's public phone number, when stated."
    },
    "cuisine": {
      "type": "string",
      "description": "The venue's cuisine, when stated."
    },
    "price_band": {
      "type": "string",
      "description": "The venue's price band (e.g. '$$'), when stated."
    },
    "neighbourhood": {
      "type": "string",
      "description": "The venue's neighbourhood, when stated."
    },
    "address": {
      "type": "object",
      "description": "The venue's postal address; present only when it states a street address. Parts it does not state are omitted.",
      "properties": {
        "street_address": {
          "type": "string"
        },
        "city": {
          "type": "string"
        },
        "region": {
          "type": "string",
          "description": "State, province or emirate."
        },
        "postal_code": {
          "type": "string"
        },
        "country": {
          "type": "string",
          "description": "ISO 3166-1 alpha-2."
        }
      },
      "required": [
        "street_address"
      ]
    },
    "address_text": {
      "type": "string",
      "description": "The address as one line, ready to quote; present with address."
    },
    "map_url": {
      "type": "string",
      "description": "A Google Maps link to the venue (by its Place ID, else its coordinates); present only when either is stated."
    },
    "hours": {
      "type": "array",
      "description": "The venue's weekly opening hours, when stated and the venue grants get_venue_profile. One entry per open interval; a venue may have several rows for one day. day_of_week is 0=Monday..6=Sunday, and closes_at earlier than opens_at is an interval wrapping past midnight into the next day.",
      "items": {
        "type": "object",
        "properties": {
          "day_of_week": {
            "type": "integer",
            "minimum": 0,
            "maximum": 6,
            "description": "0=Monday .. 6=Sunday."
          },
          "day": {
            "type": "string",
            "description": "The weekday name for day_of_week (e.g. 'monday')."
          },
          "opens_at": {
            "type": "string",
            "description": "Local opening time, HH:MM."
          },
          "closes_at": {
            "type": "string",
            "description": "Local closing time, HH:MM; earlier than opens_at wraps past midnight."
          }
        },
        "required": [
          "day_of_week",
          "opens_at",
          "closes_at"
        ]
      }
    },
    "hours_summary": {
      "type": "string",
      "description": "The week in one line, ready to quote: consecutive days with the same windows grouped, closed days last (e.g. 'Tue–Fri 17:00–22:00; Sat–Sun 11:00–23:00; closed Mon'). Present whenever hours is."
    },
    "timezone": {
      "type": "string",
      "description": "The venue's IANA timezone (e.g. 'America/Chicago'), when stated."
    },
    "open_now": {
      "type": "boolean",
      "description": "Whether the venue is open at the request time in its own timezone (open_now_at), not at a searched open_on/at time; present only when it states hours and a timezone."
    },
    "open_now_at": {
      "type": "string",
      "description": "The venue-local request time open_now was evaluated at, ISO 8601 with offset (e.g. '2026-10-30T14:05+04:00'); present with open_now."
    },
    "today": {
      "type": "object",
      "description": "Today's opening windows at the venue's local date; present only when it states hours and a timezone.",
      "properties": {
        "day": {
          "type": "string",
          "description": "Today's weekday name."
        },
        "windows": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "opens_at": {
                "type": "string",
                "description": "HH:MM."
              },
              "closes_at": {
                "type": "string",
                "description": "HH:MM."
              }
            },
            "required": [
              "opens_at",
              "closes_at"
            ]
          }
        }
      },
      "required": [
        "day",
        "windows"
      ]
    },
    "yenta_page_url": {
      "type": "string",
      "description": "The venue's page on Yenta, to open or cite; present only when it is live. Not the venue's own site: that is website."
    },
    "website": {
      "type": "string",
      "description": "The venue's own website; present only when it publishes one and grants get_venue_links."
    },
    "distance_km": {
      "type": "number",
      "description": "Kilometres from the 'near' point; present only on a proximity search."
    },
    "accepts_reservations": {
      "type": "boolean",
      "description": "true = an online or live booking is published (the same test the accepts_reservations search filter applies); false = none is published, but the venue may still take bookings by phone. Present with booking."
    },
    "how_to_book": {
      "type": "string",
      "description": "One sentence from published fields: 'Book online at <url>' or 'Call <phone>'. Omitted when the venue is not bookable."
    },
    "not_stated": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "hours",
          "address",
          "map_url",
          "phone",
          "booking",
          "links",
          "timezone",
          "cuisine"
        ]
      },
      "description": "The profile fields this venue has not published, by name; [] when it publishes them all. Present on a single-venue read only."
    },
    "capabilities": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Capability ids this venue granted (the tool names at its mcp_endpoint); the MCP directory lists the by-name venue_* tools instead."
    },
    "mcp_endpoint": {
      "type": "string",
      "description": "The venue's own read-only MCP URL, present only when the venue is live."
    },
    "match": {
      "allOf": [
        {
          "$ref": "#/$defs/Match"
        }
      ],
      "description": "This candidate's retrieval explanation (score + grounded reasons/conflicts). Present only on a ranked search_venues result — when the caller passed a query or a soft preference."
    },
    "source": {
      "allOf": [
        {
          "$ref": "#/$defs/Source"
        }
      ],
      "description": "This candidate's OWN freshness reference (its approved revision, approved_at and its page as url), so a shortlisted venue can be cited without a second get_venue. The list's response-level source stays the directory reference."
    },
    "attributes": {
      "type": "object",
      "description": "The venue's authored experiential facets, grouped by type (vibe, good_for, not_good_for, feature, noise_level, view, dress_code, meal_period, cuisine, dietary, accessibility). Present on the single-venue reads (get_venue / get_venue_profile), and on the batch /venues:batch read when 'attributes' is in include, and only when the venue has facets and grants get_venue_profile; otherwise the key is omitted. Each property is a facet type whose value is an array of entries, each carrying the canonical facet value and its provenance class.",
      "additionalProperties": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "value": {
              "type": "string",
              "description": "The canonical (hyphenated) facet value."
            },
            "source": {
              "type": "string",
              "description": "The facet's provenance class, one of: venue_verified, yenta_verified, partner_feed, public_source, inferred."
            },
            "confidence": {
              "type": "number",
              "minimum": 0,
              "maximum": 1,
              "description": "A 0-1 confidence score, present only when the source stated one (omitted for verified facts)."
            }
          },
          "required": [
            "value",
            "source"
          ]
        }
      }
    },
    "menu_summary": {
      "type": "object",
      "description": "A compact, evidence-only summary of the venue's WHOLE approved menu, so an agent can assess it without pulling every item (get_menu) or paging search_menu. Present on the single-venue reads (get_venue, and get_venue_profile on the venue's own host), and on the batch /venues:batch read when 'menu_summary' is in include, and only when the venue has an approved menu and grants search_menu; otherwise the key is omitted. Counts and ranges only — never a derived quality label or a fabricated 'signature item'.",
      "properties": {
        "item_count": {
          "type": "integer",
          "description": "Total items across the whole approved menu."
        },
        "section_count": {
          "type": "integer",
          "description": "Total sections; present only when sections is truncated."
        },
        "dietary_tag_count": {
          "type": "integer",
          "description": "Total distinct dietary tags; present only when dietary is truncated."
        },
        "sections": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Section names, first-seen deduped, in the partner's own menu order and bounded to a configured maximum."
        },
        "price_range": {
          "type": "object",
          "description": "min/max over items priced in the venue's OWN currency; omitted entirely when nothing is priced in it.",
          "properties": {
            "min": {
              "type": "string",
              "description": "Exact decimal string; never a float (it is a money value)."
            },
            "max": {
              "type": "string",
              "description": "Exact decimal string; never a float (it is a money value)."
            },
            "currency": {
              "type": "string"
            }
          },
          "required": [
            "min",
            "max",
            "currency"
          ]
        },
        "dietary": {
          "type": "object",
          "description": "Per-dietary-tag item counts, spelled exactly as the venue declared them (never normalised or invented); omitted when the menu declares none.",
          "additionalProperties": {
            "type": "integer"
          }
        }
      },
      "required": [
        "item_count",
        "sections"
      ]
    },
    "dietary": {
      "type": "object",
      "description": "The venue's dietary-tag/allergen VOCABULARY (the dietary_tags and allergens /venue/dietary-options answers, without its examples/allergen_counts) — distinct from menu_summary.dietary's per-tag item COUNTS. Present only on the batch /venues:batch read when 'dietary' is in include, and only when the venue has an approved menu and grants get_dietary_options; otherwise the key is omitted.",
      "properties": {
        "dietary_tags": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "allergens": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "not_stated": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "dietary_tags",
              "allergens"
            ]
          },
          "description": "Which of dietary_tags/allergens no item on the menu declares (that list is then empty): none declared, which may mean none or not entered. Omitted when both are declared."
        }
      },
      "required": [
        "dietary_tags",
        "allergens"
      ]
    }
  },
  "required": [
    "slug",
    "name",
    "city",
    "country",
    "currency"
  ],
  "$defs": {
    "Match": {
      "type": "object",
      "description": "A search_venues candidate's retrieval explanation, present only when ranking is active (a query or a soft prefer_cuisine/avoid/prefer_neighbourhood/prefer_facets term). No id, org or row id ever appears.",
      "properties": {
        "score": {
          "type": "number",
          "description": "Retrieval score: higher = a better match, RELATIVE to this result set — not a 0-100 quality verdict. Compare candidates within one response only; the absolute value has no standalone meaning."
        },
        "reasons": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/MatchReason"
          },
          "description": "Field-grounded POSITIVES as {attribute, value, source?, confidence?} objects (a text/cuisine/price_band/neighbourhood/facet/proximity/hours match), echoing only the row's own canonical values and closed status tokens, deduped by (attribute, value) and count-bounded by max_public_reason_terms."
        },
        "conflicts": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/MatchReason"
          },
          "description": "Field-grounded NEGATIVES (why_not) as the same objects, most decision-useful first: a matched avoid, every intrinsic not_good_for facet, an unmet soft preference (named by TYPE, value 'preference-unmet'), and the cheaply-known hours/not-published and booking/unavailable gaps; same bound as reasons."
        },
        "similarity": {
          "type": "number",
          "minimum": -1,
          "maximum": 1,
          "description": "Present only on a venue matched by meaning rather than by its words: the cosine similarity (rounded to 4 places) between the query and the venue's approved profile, higher = closer. Such venues follow every word match, closest first, and their reasons lead with {attribute: 'text', value: 'meaning'}."
        }
      },
      "required": [
        "score",
        "reasons",
        "conflicts"
      ]
    },
    "MatchReason": {
      "type": "object",
      "description": "One grounded reason/conflict. 'attribute' is a closed-vocabulary dimension name (an essentials field, a FacetType, or one of text/proximity/hours/booking/not_good_for); 'value' is EITHER the row's own canonical value OR a fixed status token (within-radius, open-now, open-at-requested-time, name, description, preference-unmet, not-published, unavailable) — never a term the caller typed. 'source'/'confidence' appear ONLY on facet-derived entries, carrying the VenueFacet's SourceType provenance and stated confidence.",
      "properties": {
        "attribute": {
          "type": "string"
        },
        "value": {
          "type": "string"
        },
        "source": {
          "type": "string",
          "description": "The facet's SourceType provenance (e.g. 'venue_verified', 'inferred'); present only on facet-derived entries."
        },
        "confidence": {
          "type": "number",
          "description": "The facet's stated confidence; present only when the row states one."
        }
      },
      "required": [
        "attribute",
        "value"
      ]
    },
    "Source": {
      "type": "object",
      "description": "Which approved revision an answer was read from.",
      "properties": {
        "content_version": {
          "type": "integer"
        },
        "source": {
          "type": "string",
          "description": "'directory' for cross-venue reads, or 'approved-content-revision:<id>' for a single venue/destination."
        },
        "approved_at": {
          "type": "string",
          "format": "date-time",
          "description": "When the cited revision was approved (ISO-8601), so an answer can be quoted 'as of' that time. Present on a single venue/destination answer and on each search_venues candidate's own per-item source; absent on a cross-venue directory footer."
        },
        "powered_by": {
          "type": "string",
          "description": "Brand signature on the entry reads only."
        },
        "url": {
          "type": "string",
          "format": "uri",
          "description": "The page a person can open to check the answer: the venue's or destination's page for the section that answered (/menu, /faq, /listings/{id}/{slug}, / for an overview). Present on an answered single venue/destination read and on each search_venues candidate's and search_menus item's own source; absent on the cross-venue directory footer and on a not_available answer."
        }
      },
      "required": [
        "content_version",
        "source"
      ]
    }
  }
}