{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "https://api.oilpriceapi.com/schemas/product-facts-v2.schema.json",
  "title": "OilPriceAPI Public Product Facts",
  "description": "Reviewed, non-secret public product facts for first-party and downstream surfaces.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schemaVersion",
    "contractVersion",
    "reviewedAt",
    "reviewOwner",
    "schemaUrl",
    "canonicalUrl",
    "product",
    "offer",
    "catalog",
    "freshness",
    "dataRights",
    "developer"
  ],
  "properties": {
    "schemaVersion": { "type": "string", "pattern": "^2\\.[0-9]+\\.[0-9]+$" },
    "contractVersion": { "type": "string", "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$" },
    "reviewedAt": { "type": "string", "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$" },
    "reviewOwner": { "type": "string", "minLength": 1 },
    "schemaUrl": { "type": "string", "format": "uri" },
    "canonicalUrl": { "type": "string", "format": "uri" },
    "product": {
      "type": "object",
      "additionalProperties": false,
      "required": ["name", "website", "apiBaseUrl", "documentationUrl", "description"],
      "properties": {
        "name": { "type": "string", "minLength": 1 },
        "website": { "type": "string", "format": "uri" },
        "apiBaseUrl": { "type": "string", "format": "uri" },
        "documentationUrl": { "type": "string", "format": "uri" },
        "description": { "type": "string", "minLength": 1 }
      }
    },
    "offer": {
      "type": "object",
      "additionalProperties": false,
      "required": ["trialDays", "trialRequests", "trialScope", "freeRequestLimit", "freeRequestWindow", "creditCardRequiredForTrial", "pricingUrl", "qualification"],
      "properties": {
        "trialDays": { "type": "integer", "minimum": 1 },
        "trialRequests": { "type": "integer", "minimum": 1 },
        "trialScope": { "type": "string", "minLength": 1 },
        "freeRequestLimit": { "type": "integer", "minimum": 1 },
        "freeRequestWindow": { "type": "string", "enum": ["day", "month"] },
        "creditCardRequiredForTrial": { "type": "boolean" },
        "pricingUrl": { "type": "string", "format": "uri" },
        "qualification": { "type": "string", "minLength": 1 }
      }
    },
    "catalog": {
      "type": "object",
      "additionalProperties": false,
      "required": ["publicWording", "exactCountPublished", "catalogUrl"],
      "properties": {
        "publicWording": { "type": "string", "minLength": 1 },
        "exactCountPublished": { "type": "boolean" },
        "catalogUrl": { "type": "string", "format": "uri" }
      }
    },
    "freshness": {
      "type": "object",
      "additionalProperties": false,
      "required": ["publicWording", "fixedSitewideCadence"],
      "properties": {
        "publicWording": { "type": "string", "minLength": 1 },
        "fixedSitewideCadence": { "type": ["string", "null"] }
      }
    },
    "dataRights": {
      "type": "object",
      "additionalProperties": false,
      "required": ["publicWording", "policyUrl"],
      "properties": {
        "publicWording": { "type": "string", "minLength": 1 },
        "policyUrl": { "type": "string", "format": "uri" }
      }
    },
    "developer": {
      "type": "object",
      "additionalProperties": false,
      "required": ["authenticationHeader", "environmentVariable", "firstRequestMethod", "firstRequestPath", "firstRequestUrl", "demoRequestUrl"],
      "properties": {
        "authenticationHeader": { "type": "string", "minLength": 1 },
        "environmentVariable": { "type": "string", "minLength": 1 },
        "firstRequestMethod": { "type": "string", "enum": ["GET"] },
        "firstRequestPath": { "type": "string", "pattern": "^/v1/" },
        "firstRequestUrl": { "type": "string", "format": "uri" },
        "demoRequestUrl": { "type": "string", "format": "uri" }
      }
    }
  }
}
