{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/wcway-com/json-schema/wcway-com-toilet-result-schema.json",
  "title": "ToiletResult",
  "x-generated": "2026-11-29",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/wcway-com-openapi.json#/components/schemas/ToiletResult",
  "type": "object",
  "required": [
    "toilet",
    "attribution",
    "display_note"
  ],
  "additionalProperties": false,
  "properties": {
    "toilet": {
      "type": "object",
      "required": [
        "id",
        "name",
        "lat",
        "lon",
        "access",
        "access_rule",
        "scheme_name",
        "fee",
        "opening_hours",
        "open_now",
        "closes_at",
        "wheelchair",
        "changing_table",
        "gender",
        "operator",
        "last_confirmed_at",
        "verification_state",
        "confirmations",
        "cleanliness",
        "confidence",
        "source",
        "partner",
        "provenance",
        "url",
        "directions",
        "geo",
        "image"
      ],
      "additionalProperties": false,
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": [
            "string",
            "null"
          ]
        },
        "lat": {
          "type": "number"
        },
        "lon": {
          "type": "number"
        },
        "access": {
          "type": "string",
          "enum": [
            "public",
            "permissive",
            "customers",
            "scheme",
            "unknown"
          ],
          "description": "Who may use the toilet. public: anyone. permissive: anyone, no purchase needed. customers: customers only. scheme: a public scheme opens a business toilet to everyone."
        },
        "access_rule": {
          "type": "string",
          "enum": [
            "free",
            "fee",
            "customers",
            "key",
            "scheme",
            "unknown"
          ],
          "description": "free and fee: public toilet. customers: purchase or customer status needed. key: key needed. scheme: a public scheme opens a business toilet to everyone. unknown: fee not known."
        },
        "scheme_name": {
          "type": [
            "string",
            "null"
          ]
        },
        "fee": {
          "type": "object",
          "required": [
            "required",
            "amount",
            "currency"
          ],
          "additionalProperties": false,
          "properties": {
            "required": {
              "type": [
                "boolean",
                "null"
              ]
            },
            "amount": {
              "type": [
                "number",
                "null"
              ]
            },
            "currency": {
              "type": [
                "string",
                "null"
              ]
            }
          }
        },
        "opening_hours": {
          "type": [
            "string",
            "null"
          ],
          "description": "OpenStreetMap opening_hours syntax."
        },
        "open_now": {
          "description": "Evaluated at the toilet's local time. The value unknown means the source has no usable hours.",
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "const": "unknown"
            }
          ]
        },
        "closes_at": {
          "type": [
            "string",
            "null"
          ],
          "description": "Local closing time with UTC offset. Null when unknown or when it never closes."
        },
        "wheelchair": {
          "type": "string",
          "enum": [
            "yes",
            "limited",
            "no",
            "unknown"
          ]
        },
        "changing_table": {
          "type": "string",
          "enum": [
            "yes",
            "no",
            "unknown"
          ]
        },
        "gender": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "unisex",
              "female",
              "male"
            ]
          },
          "description": "Who the toilet is for. Empty when not known."
        },
        "operator": {
          "type": [
            "string",
            "null"
          ]
        },
        "last_confirmed_at": {
          "type": [
            "string",
            "null"
          ]
        },
        "verification_state": {
          "type": "string",
          "enum": [
            "unverified",
            "source_claimed",
            "community_confirmed",
            "partner_confirmed",
            "disputed"
          ],
          "description": "disputed: an open user report says the toilet is gone, closed or wrong."
        },
        "confirmations": {
          "type": "integer",
          "minimum": 0,
          "description": "User confirmations in the last 12 months."
        },
        "cleanliness": {
          "anyOf": [
            {
              "type": "object",
              "required": [
                "average",
                "count"
              ],
              "additionalProperties": false,
              "properties": {
                "average": {
                  "type": "number",
                  "minimum": 1,
                  "maximum": 5
                },
                "count": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            },
            {
              "type": "null"
            }
          ],
          "description": "User ratings from 1 (dirty) to 5 (spotless). Each person has one rating, and the latest counts. Null when nobody rated it."
        },
        "confidence": {
          "type": "string",
          "enum": [
            "high",
            "medium",
            "low"
          ]
        },
        "source": {
          "type": "string"
        },
        "partner": {
          "anyOf": [
            {
              "type": "null"
            },
            {
              "type": "object",
              "required": [
                "name",
                "tier",
                "conditions",
                "opening_hours",
                "open_now",
                "closes_at"
              ],
              "additionalProperties": false,
              "properties": {
                "name": {
                  "type": "string",
                  "description": "Business name that the partner gave and a moderator approved."
                },
                "tier": {
                  "type": "string",
                  "enum": [
                    "basic",
                    "plus"
                  ]
                },
                "conditions": {
                  "anyOf": [
                    {
                      "type": "string",
                      "enum": [
                        "everyone",
                        "customers"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "What the business says about who may use the toilet. everyone: free for everyone. customers: customers only. Null when the business said nothing. It is the word of the business, not a checked fact."
                },
                "opening_hours": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "Opening hours that the business entered, in OpenStreetMap opening_hours syntax. Null when it entered none."
                },
                "open_now": {
                  "description": "Open state from the hours of the business and its live switch, at the toilet's local time. false: the business closed the toilet for now, or its hours say closed. unknown: the business gave no usable hours.",
                  "anyOf": [
                    {
                      "type": "boolean"
                    },
                    {
                      "const": "unknown"
                    }
                  ]
                },
                "closes_at": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "Local closing time with UTC offset, from the hours of the business. Null when unknown or when it never closes."
                }
              }
            }
          ],
          "description": "Set when the business behind the toilet pays for a Verified Partner listing. It buys visibility and a label. It never changes the order of the results. Show it as a label only. Conditions, opening_hours and open_now are statements of the business. The toilet's own fields (access, opening_hours, open_now) stay as they are."
        },
        "provenance": {
          "type": "object",
          "required": [
            "source",
            "checked",
            "decided"
          ],
          "additionalProperties": false,
          "description": "Where the facts come from. People can correct every fact. A value that most people vote for replaces the source value. Every fact comes from the source, unless decided lists it.",
          "properties": {
            "source": {
              "type": "string",
              "description": "Source of the toilet record, for example osm."
            },
            "checked": {
              "type": [
                "string",
                "null"
              ],
              "description": "Month of the last check in the source, for example 2025-06."
            },
            "decided": {
              "type": "object",
              "description": "Facts that people or a moderator decided. The keys are access, fee, fee_amount, wheelchair, changing_table, gender, opening_hours, name, operator and existence.",
              "propertyNames": {
                "enum": [
                  "access",
                  "fee",
                  "fee_amount",
                  "wheelchair",
                  "changing_table",
                  "gender",
                  "opening_hours",
                  "name",
                  "operator",
                  "existence"
                ]
              },
              "additionalProperties": {
                "type": "object",
                "required": [
                  "by",
                  "votes_for",
                  "votes_total",
                  "as_of"
                ],
                "additionalProperties": false,
                "properties": {
                  "by": {
                    "type": "string",
                    "enum": [
                      "votes",
                      "moderator"
                    ],
                    "description": "votes: most people voted for the shown value. moderator: a moderator locked the value."
                  },
                  "votes_for": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 0,
                    "description": "People who voted for the shown value. The source value counts as one vote. Null for a moderator."
                  },
                  "votes_total": {
                    "type": [
                      "integer",
                      "null"
                    ],
                    "minimum": 0,
                    "description": "All votes in the last 24 months, including the source value."
                  },
                  "as_of": {
                    "type": "string",
                    "description": "Date of the last count."
                  }
                }
              }
            }
          }
        },
        "url": {
          "type": "string",
          "format": "uri"
        },
        "directions": {
          "type": "object",
          "required": [
            "google",
            "apple"
          ],
          "additionalProperties": false,
          "properties": {
            "google": {
              "type": "string",
              "format": "uri"
            },
            "apple": {
              "type": "string",
              "format": "uri"
            }
          }
        },
        "geo": {
          "type": "string",
          "description": "geo: URI."
        },
        "image": {
          "anyOf": [
            {
              "type": "object",
              "required": [
                "url",
                "width",
                "height",
                "credit",
                "licence",
                "licence_url",
                "source_url"
              ],
              "additionalProperties": false,
              "properties": {
                "url": {
                  "type": "string",
                  "format": "uri",
                  "description": "The picture, served from this site. A client needs no other host."
                },
                "width": {
                  "type": "integer",
                  "minimum": 1
                },
                "height": {
                  "type": "integer",
                  "minimum": 1
                },
                "credit": {
                  "type": "string",
                  "description": "Name of the author. Show it next to the photo."
                },
                "licence": {
                  "type": "string",
                  "description": "Short name of the licence, for example CC BY-SA 4.0. Show it next to the photo."
                },
                "licence_url": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "format": "uri",
                  "description": "Text of the licence. Null for a work in the public domain."
                },
                "source_url": {
                  "type": "string",
                  "format": "uri",
                  "description": "Page of the picture at Wikimedia Commons or Panoramax."
                }
              }
            },
            {
              "type": "null"
            }
          ],
          "description": "A photo of the toilet. OpenStreetMap links it from Wikimedia Commons or Panoramax. It is set only when the licence is free (CC0, public domain, CC BY, CC BY-SA, Etalab Open Licence) and the author is known. Else it is null. Show credit and licence next to the photo."
        }
      }
    },
    "attribution": {
      "type": "object",
      "required": [
        "text",
        "license",
        "url",
        "license_notice_url"
      ],
      "additionalProperties": false,
      "properties": {
        "text": {
          "type": "string"
        },
        "license": {
          "type": "string"
        },
        "url": {
          "type": "string",
          "format": "uri"
        },
        "license_notice_url": {
          "type": "string",
          "format": "uri",
          "description": "The page that lists every source with its licence and offers the data dumps."
        }
      }
    },
    "display_note": {
      "type": "string"
    }
  }
}