{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/nogpets-com/json-schema/nogpets-com-business-application-schema.json",
  "title": "BusinessApplication",
  "x-generated": "2026-11-19",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/nogpets-com-openapi.json#/components/schemas/BusinessApplication",
  "type": "object",
  "required": [
    "applicationId",
    "status",
    "business",
    "checklist",
    "readyToSubmit",
    "next"
  ],
  "properties": {
    "applicationId": {
      "type": "string"
    },
    "status": {
      "$ref": "#/$defs/ApplicationStatus"
    },
    "business": {
      "type": "object",
      "additionalProperties": true
    },
    "listing": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "town": {
          "type": "string"
        }
      }
    },
    "services": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": true
      }
    },
    "areas": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": true
      },
      "description": "Proposed territories, PENDING until approved."
    },
    "overlaps": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "area": {
            "type": "string"
          },
          "territory": {
            "type": "string"
          },
          "grantedTo": {
            "type": "string"
          }
        }
      }
    },
    "resources": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": true
      }
    },
    "invites": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": true
      }
    },
    "payfast": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "merchantId": {
          "type": "string"
        },
        "split": {
          "type": "boolean"
        },
        "status": {
          "type": "string"
        }
      }
    },
    "whatsappOptIn": {
      "type": "boolean"
    },
    "plan": {
      "type": "null",
      "description": "Reserved: NogPets' plan for the business. Not set yet; pricing is by conversation."
    },
    "checklist": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/ChecklistItem"
      }
    },
    "readyToSubmit": {
      "type": "boolean"
    },
    "reviewNote": {
      "type": "string",
      "description": "Why NogPets asked for changes."
    },
    "bizId": {
      "type": "string",
      "description": "The business, once approved."
    },
    "possibleListings": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": true
      },
      "description": "Directory listings that may be this business: offer to claim one."
    },
    "payfastInfo": {
      "type": "string"
    },
    "summary": {
      "type": "string"
    },
    "statusUrl": {
      "type": [
        "string",
        "null"
      ],
      "format": "uri",
      "description": "A page the person can open to see the checklist and status."
    },
    "welcomeUrl": {
      "type": "string",
      "format": "uri",
      "description": "What NogPets offers businesses, for the person to read."
    },
    "next": {
      "type": "string",
      "description": "What to do now."
    }
  },
  "$defs": {
    "ApplicationStatus": {
      "type": "string",
      "enum": [
        "DRAFT",
        "SUBMITTED",
        "APPROVED",
        "REJECTED"
      ],
      "description": "DRAFT while it's being filled in; SUBMITTED while NogPets reviews it; APPROVED (the business exists, bizId) or REJECTED (reviewNote says why; editing it makes it a DRAFT again)."
    },
    "ChecklistItem": {
      "type": "object",
      "required": [
        "id",
        "label",
        "done",
        "required"
      ],
      "properties": {
        "id": {
          "type": "string",
          "enum": [
            "details",
            "services",
            "area",
            "resources",
            "payfast",
            "payout",
            "staff",
            "listing"
          ]
        },
        "label": {
          "type": "string"
        },
        "done": {
          "type": "boolean"
        },
        "required": {
          "type": "boolean"
        },
        "detail": {
          "type": "string"
        }
      }
    }
  }
}