{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/flashdata-dev/json-schema/flashdata-dev-console-overview-schema.json",
  "title": "ConsoleOverview",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/flashdata-dev-overview-api-openapi.yml#/components/schemas/ConsoleOverview",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "account",
    "onboarding",
    "subscription",
    "balance",
    "publicStatus",
    "degradedSections",
    "generatedAt"
  ],
  "properties": {
    "account": {
      "$ref": "#/$defs/Account"
    },
    "onboarding": {
      "$ref": "#/$defs/OnboardingProgress"
    },
    "subscription": {
      "oneOf": [
        {
          "$ref": "#/$defs/Subscription"
        },
        {
          "type": "null"
        }
      ]
    },
    "balance": {
      "oneOf": [
        {
          "$ref": "#/$defs/CreditBalance"
        },
        {
          "type": "null"
        }
      ]
    },
    "publicStatus": {
      "oneOf": [
        {
          "$ref": "#/$defs/PublicStatus"
        },
        {
          "type": "null"
        }
      ]
    },
    "degradedSections": {
      "type": "array",
      "uniqueItems": true,
      "items": {
        "type": "string",
        "enum": [
          "subscription",
          "balance",
          "public_status"
        ]
      },
      "description": "A listed section uses its unavailable representation; null and empty values must not be interpreted as zero or healthy."
    },
    "generatedAt": {
      "type": "string",
      "format": "date-time"
    }
  },
  "$defs": {
    "Account": {
      "type": "object",
      "description": "Deleted accounts are only returned through authorized Admin projections; their identity fields are redacted.",
      "additionalProperties": false,
      "required": [
        "id",
        "name",
        "email",
        "status",
        "emailVerified",
        "legalAcceptanceRequired",
        "role",
        "timezone",
        "createdAt",
        "updatedAt"
      ],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^acct_"
        },
        "name": {
          "type": "string"
        },
        "email": {
          "type": [
            "string",
            "null"
          ],
          "format": "email"
        },
        "status": {
          "type": "string",
          "enum": [
            "pending_verification",
            "active",
            "suspended",
            "deleting",
            "deleted"
          ]
        },
        "emailVerified": {
          "type": "boolean"
        },
        "legalAcceptanceRequired": {
          "type": "boolean"
        },
        "role": {
          "type": "string",
          "enum": [
            "user",
            "admin"
          ]
        },
        "timezone": {
          "type": "string",
          "minLength": 1,
          "maxLength": 80
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "CreditBalance": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "balanceCredits",
        "reservedCredits",
        "availableCredits",
        "lifetimeGrantedCredits",
        "lifetimeUsedCredits",
        "lifetimeRefundedCredits",
        "lifetimePaymentReversedCredits",
        "updatedAt"
      ],
      "properties": {
        "balanceCredits": {
          "type": "number",
          "multipleOf": 0.001,
          "description": "Signed settled balance after grants, usage, refunds and provider reversals."
        },
        "reservedCredits": {
          "type": "number",
          "minimum": 0,
          "multipleOf": 0.001
        },
        "availableCredits": {
          "type": "number",
          "minimum": 0,
          "multipleOf": 0.001,
          "description": "max(balanceCredits, 0)."
        },
        "lifetimeGrantedCredits": {
          "type": "number",
          "minimum": 0,
          "multipleOf": 0.001
        },
        "lifetimeUsedCredits": {
          "type": "number",
          "minimum": 0,
          "multipleOf": 0.001
        },
        "lifetimeRefundedCredits": {
          "type": "number",
          "minimum": 0,
          "multipleOf": 0.001,
          "description": "Credits returned to the account after failed usage."
        },
        "lifetimePaymentReversedCredits": {
          "type": "number",
          "minimum": 0,
          "multipleOf": 0.001,
          "description": "Absolute Credits removed after verified provider refunds or chargebacks."
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "OnboardingProgress": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "currentStep",
        "apiKeyStepStatus",
        "firstRequestStatus",
        "version",
        "updatedAt"
      ],
      "properties": {
        "currentStep": {
          "type": "string",
          "enum": [
            "welcome",
            "api_key",
            "first_request",
            "completed"
          ]
        },
        "useCase": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "google_search",
            "youtube_data",
            "download",
            null
          ]
        },
        "apiKeyStepStatus": {
          "type": "string",
          "enum": [
            "pending",
            "created",
            "skipped"
          ]
        },
        "firstRequestStatus": {
          "type": "string",
          "enum": [
            "pending",
            "succeeded",
            "skipped"
          ]
        },
        "firstApiKeyId": {
          "type": [
            "string",
            "null"
          ],
          "pattern": "^key_"
        },
        "firstRequestId": {
          "type": [
            "string",
            "null"
          ],
          "pattern": "^req_"
        },
        "completedAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "version": {
          "type": "integer",
          "minimum": 0
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "Plan": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "slug",
        "name",
        "description",
        "includedCredits",
        "limits",
        "prices",
        "features",
        "usagePrices"
      ],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^plan_"
        },
        "slug": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "includedCredits": {
          "type": "number",
          "minimum": 0,
          "multipleOf": 0.001,
          "description": "Credits included in each paid subscription cycle; zero for Pay As You Go."
        },
        "limits": {
          "$ref": "#/$defs/PlanLimits"
        },
        "prices": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/PlanPrice"
          }
        },
        "features": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "usagePrices": {
          "$ref": "#/$defs/PlanUsagePrices"
        }
      }
    },
    "PlanLimits": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "concurrency",
        "maxBatchSize",
        "maxPendingJobs"
      ],
      "properties": {
        "concurrency": {
          "type": "integer",
          "minimum": 1
        },
        "maxBatchSize": {
          "type": "integer",
          "minimum": 1
        },
        "maxPendingJobs": {
          "type": "integer",
          "minimum": 1
        }
      }
    },
    "PlanPrice": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "currency",
        "unitAmount",
        "credits",
        "type",
        "interval"
      ],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^prc_"
        },
        "currency": {
          "type": "string",
          "const": "USD"
        },
        "unitAmount": {
          "type": "integer",
          "minimum": 0,
          "description": "USD cents"
        },
        "credits": {
          "type": "number",
          "minimum": 0,
          "multipleOf": 0.001,
          "description": "Credits granted by a successful one-time top-up; zero for recurring prices."
        },
        "type": {
          "type": "string",
          "enum": [
            "recurring",
            "one_time"
          ]
        },
        "interval": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "month",
            "year",
            null
          ]
        }
      }
    },
    "PlanUsagePrices": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "googlePer1kCents",
        "youtubePer1kCents",
        "downloadPerTbCents"
      ],
      "properties": {
        "googlePer1kCents": {
          "type": "integer",
          "minimum": 0,
          "description": "Google request price per 1,000 successful requests, in USD cents."
        },
        "youtubePer1kCents": {
          "type": "integer",
          "minimum": 0,
          "description": "Standard YouTube request price per 1,000 successful requests, in USD cents."
        },
        "downloadPerTbCents": {
          "type": "integer",
          "minimum": 0,
          "description": "Download price per decimal TB (1,000,000,000,000 bytes), in USD cents."
        }
      }
    },
    "PublicStatus": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "status",
        "updatedAt",
        "components"
      ],
      "properties": {
        "status": {
          "type": "string",
          "enum": [
            "healthy",
            "degraded",
            "outage"
          ]
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time"
        },
        "components": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/PublicStatusComponent"
          }
        }
      }
    },
    "PublicStatusComponent": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id",
        "name",
        "status"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "status": {
          "type": "string",
          "enum": [
            "operational",
            "degraded",
            "outage"
          ]
        }
      }
    },
    "Subscription": {
      "type": "object",
      "description": "Effective entitlement projection. `status=payg` and `id=null` means no billing subscription record exists.",
      "additionalProperties": false,
      "required": [
        "status",
        "plan",
        "cancelAtPeriodEnd",
        "usageRates"
      ],
      "properties": {
        "id": {
          "type": [
            "string",
            "null"
          ],
          "pattern": "^sub_"
        },
        "status": {
          "type": "string",
          "enum": [
            "payg",
            "trialing",
            "active",
            "past_due",
            "grace",
            "cancelled"
          ]
        },
        "plan": {
          "$ref": "#/$defs/Plan"
        },
        "usageRates": {
          "type": "object",
          "description": "Account-specific configured credit rates. Query rates come from the account entitlement, not the public plan catalog. One TB is 1,000,000,000,000 bytes; download charges are settled against actual bytes and rounded per result.",
          "additionalProperties": false,
          "required": [
            "customized",
            "queries",
            "downloadCreditsPerTb"
          ],
          "properties": {
            "customized": {
              "type": "boolean",
              "description": "True when an administrator configured rates for this account."
            },
            "queries": {
              "type": "array",
              "items": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "source",
                  "name",
                  "creditsPerRequest"
                ],
                "properties": {
                  "source": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  },
                  "creditsPerRequest": {
                    "type": "number",
                    "minimum": 0
                  }
                }
              }
            },
            "downloadCreditsPerTb": {
              "type": "number",
              "minimum": 0
            }
          }
        },
        "currentPeriodStart": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "currentPeriodEnd": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "cancelAtPeriodEnd": {
          "type": "boolean"
        },
        "graceEndsAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        }
      }
    }
  }
}