{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/patricia-app/json-schema/patricia-app-shared-asset-view-schema.json",
  "title": "SharedAssetView",
  "description": "One shared file as its READER sees it — the capability-scoped shape behind ``/shared/<token>``.\n\nEverything a page needs to show the file honestly, and nothing that describes the workspace it\ncame from. There is no tenant, no folder, no version history and no sibling here, because the\ntoken addresses ONE file: a field that named anything else would be describing something the\nholder was never handed.\n\nMembers receive ``visibility``, ``can_change_visibility`` and ``asset_id`` with values for their\naccess. Outside readers receive these three fields as ``null``, ``false`` and ``null``.\nMembers also receive ``is_owner`` and ``requires_access_acknowledgement``. The server omits both\nfields for outside readers. These fields tell members whose file they see and whether opening\nit requires a recorded acknowledgement.\n\nThe server decides whether the page offers the visibility control through\n``can_change_visibility``. The ``PUT /assets/{id}/visibility`` route checks the same authority.\n\n``name`` is UNTRUSTED text, exactly as it is on the authenticated surface — an agent run names\nan asset. It goes out as a plain JSON string and the page renders it as text, never as markup.",
  "x-generated": "2026-11-20",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/patricia-app-openapi.json#/components/schemas/SharedAssetView",
  "properties": {
    "is_owner": {
      "type": "boolean",
      "title": "Is Owner",
      "description": "Whether the signed-in caller owns this file."
    },
    "requires_access_acknowledgement": {
      "type": "boolean",
      "title": "Requires Access Acknowledgement",
      "description": "Whether content requires an access_acknowledgement UUID and a durable audit receipt."
    },
    "name": {
      "type": "string",
      "title": "Name",
      "description": "The file's name. UNTRUSTED text: render escaped."
    },
    "category": {
      "type": "string",
      "enum": [
        "document",
        "media",
        "app"
      ],
      "title": "Category",
      "description": "Which library it came from: 'document' or 'media'."
    },
    "kind": {
      "type": "string",
      "enum": [
        "app",
        "audio",
        "deck",
        "docx",
        "file",
        "html",
        "image",
        "markdown",
        "pdf",
        "slides",
        "spreadsheet",
        "video"
      ],
      "title": "Kind",
      "description": "What sort of file this is, for the icon and the preview."
    },
    "content_type": {
      "type": "string",
      "title": "Content Type",
      "description": "The current version's media type, e.g. 'application/pdf'."
    },
    "byte_size": {
      "type": "integer",
      "title": "Byte Size",
      "description": "The current version's size in bytes."
    },
    "created_at": {
      "type": "string",
      "format": "date-time",
      "title": "Created At",
      "description": "When the file was made (UTC)."
    },
    "updated_at": {
      "type": "string",
      "format": "date-time",
      "title": "Updated At",
      "description": "When the file last changed (UTC)."
    },
    "author": {
      "$ref": "#/$defs/SharedAssetAuthor",
      "description": "Who made the file: the page's 'Shared by' line."
    },
    "expires_at": {
      "anyOf": [
        {
          "type": "string",
          "format": "date-time"
        },
        {
          "type": "null"
        }
      ],
      "title": "Expires At",
      "description": "When this link expires. Null means no end date."
    },
    "thumbnail_status": {
      "type": "string",
      "enum": [
        "ready",
        "pending",
        "unavailable"
      ],
      "title": "Thumbnail Status",
      "description": "Whether a preview image exists for this file. 'ready' means GET /shared-assets/{token}/thumbnail serves it; 'pending' means one is being prepared, ask again shortly; 'unavailable' means the type icon is the answer.",
      "default": "unavailable"
    },
    "visibility": {
      "anyOf": [
        {
          "type": "string",
          "enum": [
            "private",
            "team",
            "external"
          ]
        },
        {
          "type": "null"
        }
      ],
      "title": "Visibility",
      "description": "Who can open this file, so the page can say so. Answered only for a signed-in member of the workspace that owns it; null for anyone else, because who else can read a file is not a stranger's business."
    },
    "can_change_visibility": {
      "type": "boolean",
      "title": "Can Change Visibility",
      "description": "Whether YOU may change who can see this file from this page. True only when every condition PUT /assets/{id}/visibility checks for itself already holds: you are a member of this file's workspace, your session is signed in to THAT workspace, your role carries assets:edit, and you own the file or are a workspace admin. False for anyone else, so a control enabled by this flag is never refused by that request.",
      "default": false
    },
    "asset_id": {
      "anyOf": [
        {
          "type": "string",
          "format": "uuid"
        },
        {
          "type": "null"
        }
      ],
      "title": "Asset Id",
      "description": "This file's id, for the PUT /assets/{id}/visibility call the control above makes. Null for anyone who is not a signed-in member of the workspace that owns it."
    },
    "layout": {
      "anyOf": [
        {
          "$ref": "#/$defs/DashboardLayout"
        },
        {
          "type": "null"
        }
      ],
      "description": "The tile arrangement saved for the dashboard version this page shows. Null means the version uses the layout authored in its page."
    }
  },
  "additionalProperties": false,
  "type": "object",
  "required": [
    "name",
    "category",
    "kind",
    "content_type",
    "byte_size",
    "created_at",
    "updated_at"
  ],
  "$defs": {
    "DashboardLayout": {
      "properties": {
        "tiles": {
          "items": {
            "$ref": "#/$defs/DashboardLayoutTile"
          },
          "type": "array",
          "maxItems": 200,
          "title": "Tiles"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "tiles"
      ],
      "title": "DashboardLayout",
      "description": "A dashboard version's arrangement. A version with no layout keeps its authored one."
    },
    "DashboardLayoutTile": {
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[A-Za-z0-9_-]{1,64}$",
          "title": "Id"
        },
        "column": {
          "type": "integer",
          "maximum": 12.0,
          "minimum": 1.0,
          "title": "Column"
        },
        "width": {
          "type": "integer",
          "maximum": 12.0,
          "minimum": 1.0,
          "title": "Width"
        },
        "row": {
          "type": "integer",
          "maximum": 500.0,
          "minimum": 1.0,
          "title": "Row"
        },
        "height": {
          "type": "integer",
          "maximum": 100.0,
          "minimum": 1.0,
          "title": "Height"
        },
        "hidden": {
          "type": "boolean",
          "title": "Hidden",
          "default": false
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "id",
        "column",
        "width",
        "row",
        "height"
      ],
      "title": "DashboardLayoutTile",
      "description": "One tile's place: columns and rows count from 1."
    },
    "SharedAssetAuthor": {
      "properties": {
        "display_name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Display Name",
          "description": "The name of the person who made the file. Null when nothing resolves."
        },
        "made_by_patricia": {
          "type": "boolean",
          "title": "Made By Patricia",
          "description": "Whether a Patricia run created this file. True with a display_name reads 'Patricia for <name>'; true without one reads 'Patricia'; false reads the name alone.",
          "default": false
        }
      },
      "additionalProperties": false,
      "type": "object",
      "title": "SharedAssetAuthor",
      "description": "Who made a shared file, for the person the link was sent to.\n\nDeliberately NOT :class:`AssetAuthor`, and the missing field is the whole point: this shape has\nno ``actor_id`` to fill, so the public surface cannot carry a workspace member's identifier\nhowever it is later edited. A name is what \"who sent me this\" wants; an id addresses nothing a\nrecipient can open and everything a scraper would like."
    }
  }
}