{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/tuqo-ru/json-schema/tuqo-ru-site-schema.json",
  "title": "Site",
  "description": "Project site (`shared::model::Site` + computed `url`, `form_endpoint`). The `recommendations` field is added only in GET /api/v1/sites/{id}.",
  "x-generated": "2026-11-27",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/tuqo-ru-openapi.json#/components/schemas/Site",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "project_id": {
      "type": "string",
      "format": "uuid"
    },
    "name": {
      "type": "string"
    },
    "description": {
      "type": "string",
      "description": "Site description (empty string if none)."
    },
    "subdomain": {
      "type": "string",
      "description": "Site name, one for all platform zones: the site opens at `https://<subdomain>.<zone>` — tuqo.app by default (any plan), tuqo.ru and tuqo.dev on paid plans (see `addresses` and `GET /api/v1/zones`)."
    },
    "active_deploy_id": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid",
      "description": "Current live deploy (null until one is activated)."
    },
    "enabled": {
      "type": "boolean",
      "description": "Manual serving switch (false → “temporarily unavailable”)."
    },
    "subdomain_enabled": {
      "type": "boolean",
      "description": "Whether the platform address on `tuqo.ru` is served (custom domains keep working)."
    },
    "subdomain_redirect_enabled": {
      "type": "boolean",
      "description": "When the subdomain is disabled: true → 301 to a working address."
    },
    "subdomain_redirect_to": {
      "type": [
        "string",
        "null"
      ],
      "description": "Subdomain redirect target (host); null → automatic."
    },
    "pending_subdomain": {
      "type": [
        "string",
        "null"
      ],
      "description": "Scheduled address change: the new subdomain is already reserved for the site; the switch happens at `subdomain_switch_at` (null = no change scheduled)."
    },
    "subdomain_switch_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "When the scheduled address change takes effect (24 hours after the request)."
    },
    "subdomain_changed_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "Last completed address change; the next one is available 7 days later."
    },
    "access_mode": {
      "type": "string",
      "enum": [
        "public",
        "restricted"
      ],
      "description": "`restricted` — the site is gated (see the access group)."
    },
    "keep_deploys": {
      "type": "integer",
      "description": "How many deploy copies to keep (active + archived)."
    },
    "retention_days": {
      "type": "integer",
      "description": "Auto-delete archived copies older than N days (0 = off)."
    },
    "checks_enabled": {
      "type": "boolean",
      "description": "Whether to compute site checks (recommendations) on publish."
    },
    "compressed_files": {
      "type": "boolean",
      "description": "Option “Compressed build files”: `.br`/`.gz` are served with `Content-Encoding` (compressed Unity builds)."
    },
    "lang": {
      "type": "string",
      "enum": [
        "ru",
        "en"
      ],
      "description": "Language of the platform pages visitors see on this site (login screen, 404, “temporarily unavailable”). A new site starts with the owner's account language. Unless set manually in the panel, every activated deploy updates it from the start of `index.html`: Cyrillic in `<title>` means `ru`, otherwise `<html lang>` (`ru` or `en`) decides; anything else leaves it unchanged."
    },
    "lang_manual": {
      "type": "boolean",
      "description": "true — `lang` was set manually in the panel and deploys do not change it."
    },
    "avatar": {
      "type": "integer",
      "minimum": 1,
      "maximum": 100,
      "description": "Site picture number in the dashboard (1–100, one of the isometric \"worlds\"). Assigned at random when the site is created; changed by the owner in the dashboard. Informational for agents."
    },
    "deletion_scheduled_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "Site in trash: time of the deletion request (null = active)."
    },
    "deletion_reason": {
      "type": "string",
      "description": "Deletion reason: \"owner\" — the site is active or was deleted by the owner, \"billing\" — scheduled for deletion for non-payment. Column TEXT NOT NULL DEFAULT 'owner': never an empty string.",
      "enum": [
        "owner",
        "billing"
      ]
    },
    "auto_disabled_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "Site stopped automatically or by an operator (null = normal state)."
    },
    "disabled_reason": {
      "type": [
        "string",
        "null"
      ]
    },
    "blocked_at": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time",
      "description": "Site blocked by Tuqo administration (phishing or a terms violation). Visitors see a block notice; the site is read-only: every write request to /api/v1/sites/{id}/… returns 403 until support lifts the block."
    },
    "created_at": {
      "type": "string",
      "format": "date-time"
    },
    "updated_at": {
      "type": "string",
      "format": "date-time"
    },
    "url": {
      "type": "string",
      "format": "uri",
      "description": "Working address of the site: the first enabled one — platform addresses (zone of creation first), then verified custom domains; if all are off, the platform address on the zone of creation. Show this to the user as the site link (computed field)."
    },
    "addresses": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/SiteAddress"
      },
      "description": "All addresses of the site: platform addresses by zone, then verified custom domains, each with `enabled` (computed field)."
    },
    "pending_url": {
      "type": "string",
      "format": "uri",
      "description": "Future address on the zone of creation while an address change is scheduled (present only then)."
    },
    "form_endpoint": {
      "type": "string",
      "format": "uri",
      "description": "Where the site form sends submissions: `https://api.<host>/f/<site_id>` (computed field)."
    },
    "recommendations": {
      "$ref": "#/$defs/Recommendations"
    }
  },
  "required": [
    "id",
    "project_id",
    "name",
    "description",
    "subdomain",
    "active_deploy_id",
    "enabled",
    "subdomain_enabled",
    "subdomain_redirect_enabled",
    "subdomain_redirect_to",
    "pending_subdomain",
    "subdomain_switch_at",
    "subdomain_changed_at",
    "access_mode",
    "keep_deploys",
    "retention_days",
    "checks_enabled",
    "deletion_scheduled_at",
    "deletion_reason",
    "auto_disabled_at",
    "disabled_reason",
    "blocked_at",
    "lang",
    "lang_manual",
    "avatar",
    "created_at",
    "updated_at",
    "url",
    "addresses",
    "form_endpoint"
  ],
  "$defs": {
    "Finding": {
      "type": "object",
      "properties": {
        "code": {
          "type": "string",
          "description": "Machine-readable finding code."
        },
        "level": {
          "type": "string",
          "enum": [
            "fix",
            "improve"
          ],
          "description": "`fix` — worth fixing, `improve` — a suggestion."
        },
        "title": {
          "type": "string"
        },
        "why": {
          "type": "string",
          "description": "Why it matters."
        },
        "how": {
          "type": "string",
          "description": "How to fix it."
        },
        "where": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "File paths where it was found."
        }
      },
      "required": [
        "code",
        "level",
        "title",
        "why",
        "how",
        "where"
      ],
      "description": "A site checks recommendation item (`shared::checks::Finding`)."
    },
    "Recommendations": {
      "type": "object",
      "properties": {
        "summary": {
          "type": "object",
          "properties": {
            "fix": {
              "type": "integer"
            },
            "improve": {
              "type": "integer"
            }
          },
          "description": "Number of findings of each level in the whole report."
        },
        "items": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Finding"
          },
          "description": "First 5 items (most important first)."
        },
        "more": {
          "type": "integer",
          "description": "Number of items not shown."
        },
        "note": {
          "type": "string",
          "description": "Reminder: these are suggestions about files, not errors — the site is published and working."
        }
      },
      "required": [
        "summary",
        "items",
        "more",
        "note"
      ],
      "description": "Recommendations for the latest publish (`shared::checks::recommendations`). Present only if the site's `checks_enabled` switch is on and the report is not empty."
    },
    "SiteAddress": {
      "type": "object",
      "required": [
        "type",
        "host",
        "url",
        "enabled",
        "primary"
      ],
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "zone",
            "domain"
          ],
          "description": "`zone` — the site name on a platform zone, `domain` — a verified custom domain."
        },
        "host": {
          "type": "string",
          "description": "Host name, e.g. `online-shop.tuqo.app` or `shop.com`."
        },
        "url": {
          "type": "string",
          "format": "uri",
          "description": "`https://<host>`."
        },
        "enabled": {
          "type": "boolean",
          "description": "Whether this address is served; a disabled one redirects to a working address or shows a stub."
        },
        "zone": {
          "type": "string",
          "description": "Platform zone key (`ru`), only for `type: zone`."
        },
        "primary": {
          "type": "boolean",
          "description": "The main address on Tuqo (chosen by the owner, otherwise the zone the site was created on): `url`, links and redirects point to it. Exactly one among zone addresses; always false for custom domains."
        },
        "redirect_enabled": {
          "type": "boolean",
          "description": "Only for `type: zone`: a disabled address redirects to the working address (true) or shows an unavailable page (false)."
        },
        "redirect_to": {
          "type": [
            "string",
            "null"
          ],
          "description": "Only for `type: zone`: redirect target host; null — the working (main) address."
        }
      }
    }
  }
}