{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/schedulin-app/json-schema/schedulin-app-client-profile-schema.json",
  "title": "ClientProfile",
  "x-generated": "2026-11-24",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/schedulin-app-openapi.json#/components/schemas/ClientProfile",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "externalId": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    },
    "name": {
      "type": "string"
    },
    "socialAccounts": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "platform": {
            "enum": [
              "bluesky",
              "facebook",
              "google_business_profile",
              "instagram",
              "linkedin",
              "pinterest",
              "reddit",
              "snapchat",
              "threads",
              "tiktok",
              "tiktok_business",
              "twitter",
              "youtube",
              "mastodon",
              "telegram",
              "devto",
              "hashnode",
              "medium",
              "wordpress",
              "lemmy",
              "nostr",
              "discord",
              "dribbble",
              "farcaster",
              "kick",
              "listmonk",
              "mewe",
              "moltbook",
              "skool",
              "slack",
              "twitch",
              "vk",
              "whop"
            ],
            "type": "string"
          },
          "status": {
            "enum": [
              "connected",
              "disconnected"
            ],
            "type": "string"
          },
          "disconnectedReason": {
            "$ref": "#/$defs/SocialAccountDisconnectedReason"
          },
          "username": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "displayName": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "customName": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "Nickname the workspace gave this account in Schedulin. Null when not renamed; `displayName` / `username` always hold the platform's own name."
          },
          "handle": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The account's platform @handle when known (e.g. TikTok username), without the @. Null when unknown."
          },
          "profileImageUrl": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "refreshTokenValid": {
            "type": "boolean"
          },
          "analyticsDisabledAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "x-native-type": "date"
              },
              {
                "type": "null"
              }
            ]
          },
          "webhookSubscriptionFailedAt": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "x-native-type": "date"
              },
              {
                "type": "null"
              }
            ]
          },
          "profileId": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "connectedVia": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  }
                },
                "required": [
                  "id",
                  "name"
                ]
              },
              {
                "type": "null"
              }
            ],
            "description": "The platform profile whose login connected this account (e.g. the Facebook user a Page was connected through). Null when unknown."
          },
          "createdAt": {
            "type": "string",
            "format": "date-time",
            "x-native-type": "date"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time",
            "x-native-type": "date"
          }
        },
        "required": [
          "id",
          "platform",
          "status",
          "disconnectedReason",
          "username",
          "displayName",
          "customName",
          "handle",
          "profileImageUrl",
          "refreshTokenValid",
          "analyticsDisabledAt",
          "webhookSubscriptionFailedAt",
          "profileId",
          "connectedVia",
          "createdAt",
          "updatedAt"
        ]
      }
    },
    "createdAt": {
      "type": "string",
      "format": "date-time",
      "x-native-type": "date"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time",
      "x-native-type": "date"
    }
  },
  "required": [
    "id",
    "externalId",
    "name",
    "socialAccounts",
    "createdAt",
    "updatedAt"
  ],
  "$defs": {
    "SocialAccountDisconnectedReason": {
      "anyOf": [
        {
          "enum": [
            "TOKEN_EXPIRED",
            "TOKEN_INVALID",
            "TOKEN_REVOKED",
            "REFRESH_FAILED",
            "ACCOUNT_SUSPENDED",
            "PERMISSION_DENIED",
            "EMAIL_UNCONFIRMED"
          ],
          "type": "string"
        },
        {
          "type": "null"
        }
      ]
    }
  }
}