{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://cardholderaccess.com/data/schema.json",
  "title": "CardholderAccess.com open data feeds",
  "$defs": {
    "museums": {
      "type": "object",
      "required": [
        "schema_version",
        "generated_at",
        "license",
        "attribution",
        "count",
        "items"
      ],
      "properties": {
        "schema_version": {
          "type": "string"
        },
        "generated_at": {
          "type": "string",
          "format": "date-time"
        },
        "license": {
          "const": "CC-BY-4.0"
        },
        "attribution": {
          "type": "string"
        },
        "count": {
          "type": "integer"
        },
        "items": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "id",
              "name",
              "city",
              "state"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "city": {
                "type": "string"
              },
              "state": {
                "type": "string",
                "pattern": "^[A-Z]{2}$"
              },
              "url": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "eligibility": {
                "type": "string"
              },
              "verified_at": {
                "type": "string"
              }
            }
          }
        }
      }
    },
    "venues": {
      "type": "object",
      "required": [
        "schema_version",
        "generated_at",
        "license",
        "attribution",
        "count",
        "items"
      ],
      "properties": {
        "schema_version": {
          "type": "string"
        },
        "generated_at": {
          "type": "string",
          "format": "date-time"
        },
        "license": {
          "const": "CC-BY-4.0"
        },
        "attribution": {
          "type": "string"
        },
        "count": {
          "type": "integer"
        },
        "items": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "id",
              "slug",
              "name",
              "city",
              "state",
              "trust_tier",
              "perks"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "slug": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "city": {
                "type": "string"
              },
              "state": {
                "type": "string"
              },
              "trust_tier": {
                "enum": [
                  "verified",
                  "audited_zero"
                ]
              },
              "issuers": {
                "type": "array"
              },
              "perks": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "perk_id",
                    "type",
                    "title",
                    "issuer"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "presale-rules": {
      "type": "object",
      "required": [
        "schema_version",
        "generated_at",
        "license",
        "attribution",
        "count",
        "items"
      ],
      "properties": {
        "schema_version": {
          "type": "string"
        },
        "generated_at": {
          "type": "string",
          "format": "date-time"
        },
        "license": {
          "const": "CC-BY-4.0"
        },
        "attribution": {
          "type": "string"
        },
        "count": {
          "type": "integer"
        },
        "items": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "id",
              "anchor",
              "issuer",
              "name",
              "debit",
              "authorized_user",
              "business",
              "unlock"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "anchor": {
                "type": "string"
              },
              "issuer": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "debit": {
                "type": "object",
                "required": [
                  "status",
                  "answer"
                ],
                "properties": {
                  "status": {
                    "enum": [
                      "yes",
                      "no",
                      "varies",
                      "not_verified",
                      "issuer_omits"
                    ]
                  },
                  "answer": {
                    "type": "string"
                  }
                }
              },
              "authorized_user": {
                "type": "object",
                "required": [
                  "status",
                  "answer"
                ],
                "properties": {
                  "status": {
                    "enum": [
                      "yes",
                      "no",
                      "varies",
                      "not_verified",
                      "issuer_omits"
                    ]
                  },
                  "answer": {
                    "type": "string"
                  }
                }
              },
              "business": {
                "type": "object",
                "required": [
                  "status",
                  "answer"
                ],
                "properties": {
                  "status": {
                    "enum": [
                      "yes",
                      "no",
                      "varies",
                      "not_verified",
                      "issuer_omits"
                    ]
                  },
                  "answer": {
                    "type": "string"
                  }
                }
              },
              "unlock": {
                "type": "object",
                "required": [
                  "status",
                  "answer"
                ],
                "properties": {
                  "status": {
                    "enum": [
                      "yes",
                      "no",
                      "varies",
                      "not_verified",
                      "issuer_omits"
                    ]
                  },
                  "answer": {
                    "type": "string"
                  }
                }
              },
              "unlock_mechanism": {
                "enum": [
                  "card_prefix",
                  "account_link",
                  "verified_card_on_platform",
                  "pay_with_card",
                  "show_card_on_site",
                  "enrolled_card_credit",
                  "member_app",
                  "unknown"
                ]
              }
            }
          }
        }
      }
    },
    "cards": {
      "type": "object",
      "required": [
        "schema_version",
        "generated_at",
        "license",
        "attribution",
        "count",
        "items"
      ],
      "properties": {
        "schema_version": {
          "type": "string"
        },
        "generated_at": {
          "type": "string",
          "format": "date-time"
        },
        "license": {
          "const": "CC-BY-4.0"
        },
        "attribution": {
          "type": "string"
        },
        "count": {
          "type": "integer"
        },
        "items": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "id",
              "slug",
              "label",
              "issuer",
              "tags",
              "variants"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "slug": {
                "type": "string"
              },
              "label": {
                "type": "string"
              },
              "issuer": {
                "type": "string"
              },
              "tags": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "variants": {
                "type": "array"
              }
            }
          }
        }
      }
    },
    "summary": {
      "type": "object",
      "required": [
        "schema_version",
        "generated_at",
        "counts",
        "feeds"
      ]
    }
  }
}
