{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://signaltally.com/assets/agent-handoff.schema.json",
  "title": "SignalTally public sample evaluation handoff",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema_version",
    "mode",
    "domain",
    "evaluated_on",
    "observations",
    "freshness",
    "next_step",
    "outreach",
    "limitations",
    "source_url"
  ],
  "properties": {
    "schema_version": {
      "const": "1.0"
    },
    "mode": {
      "const": "public_sample_evaluation"
    },
    "domain": {
      "type": "string"
    },
    "evaluated_on": {
      "type": "string",
      "format": "date"
    },
    "observations": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "theme",
        "apple_pay",
        "popularity"
      ],
      "properties": {
        "theme": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "schema_name",
            "catalogue_class",
            "observed_on"
          ],
          "properties": {
            "schema_name": {
              "type": "string"
            },
            "catalogue_class": {
              "const": "premium"
            },
            "observed_on": {
              "type": "string",
              "format": "date"
            }
          }
        },
        "apple_pay": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "detected",
            "registration_country",
            "observed_on"
          ],
          "properties": {
            "detected": {
              "type": "boolean"
            },
            "registration_country": {
              "type": "string",
              "pattern": "^[A-Z]{2}$"
            },
            "observed_on": {
              "type": "string",
              "format": "date"
            }
          }
        },
        "popularity": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "global_rank",
            "observed_on",
            "report_url"
          ],
          "properties": {
            "global_rank": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000000
            },
            "observed_on": {
              "type": "string",
              "format": "date"
            },
            "report_url": {
              "type": "string",
              "format": "uri"
            }
          }
        }
      }
    },
    "freshness": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "maximum_age_days",
        "storefront_age_days",
        "popularity_age_days",
        "within_policy"
      ],
      "properties": {
        "maximum_age_days": {
          "type": "integer",
          "minimum": 0,
          "maximum": 3650
        },
        "storefront_age_days": {
          "type": "integer"
        },
        "popularity_age_days": {
          "type": "integer"
        },
        "within_policy": {
          "type": "boolean"
        }
      }
    },
    "next_step": {
      "enum": [
        "review_account_fit",
        "refresh_evidence_before_research"
      ]
    },
    "outreach": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "authorized",
        "verified_contact_available"
      ],
      "properties": {
        "authorized": {
          "const": false
        },
        "verified_contact_available": {
          "const": false
        }
      }
    },
    "limitations": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "string"
      }
    },
    "source_url": {
      "type": "string",
      "format": "uri"
    }
  }
}
