{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/damdafa-com/json-schema/damdafa-com-user-profile-schema.json",
  "title": "UserProfile",
  "x-generated": "2026-10-29",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/judge-damdafa-com-openapi.json#/components/schemas/UserProfile",
  "properties": {
    "providerId": {
      "$ref": "#/$defs/AUTH_PROVIDER",
      "description": "Auth provider (firebase, google, apple)"
    },
    "uid": {
      "type": "string",
      "title": "Uid",
      "description": "Firebase user ID"
    },
    "email": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Email",
      "description": "User email address"
    },
    "emailVerified": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "title": "Emailverified",
      "description": "Indicates if the user's email is verified"
    },
    "displayName": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Displayname",
      "description": "User display name"
    },
    "name": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Name",
      "description": "User's name"
    },
    "familyName": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Familyname",
      "description": "User's last name"
    },
    "profilePhoto": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Profilephoto",
      "description": "Profile photo URL"
    },
    "avatar": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Avatar"
    },
    "fcmToken": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Fcmtoken",
      "description": "FCM token for push notifications"
    },
    "phoneNumber": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Phonenumber",
      "description": "User's phone number"
    },
    "credits": {
      "anyOf": [
        {
          "additionalProperties": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "number"
              }
            ]
          },
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Credits",
      "description": "User credits balance"
    },
    "settings": {
      "anyOf": [
        {},
        {
          "type": "null"
        }
      ],
      "title": "Settings"
    },
    "privacy": {
      "anyOf": [
        {},
        {
          "type": "null"
        }
      ],
      "title": "Privacy"
    },
    "notifications": {
      "anyOf": [
        {},
        {
          "type": "null"
        }
      ],
      "title": "Notifications"
    },
    "verification": {
      "anyOf": [
        {},
        {
          "type": "null"
        }
      ],
      "title": "Verification"
    },
    "gender": {
      "anyOf": [
        {
          "$ref": "#/$defs/Gender"
        },
        {
          "type": "null"
        }
      ]
    },
    "subscriptions": {
      "items": {
        "$ref": "#/$defs/UserSubscriptionSchema"
      },
      "type": "array",
      "title": "Subscriptions",
      "description": "User's subscriptions"
    },
    "activeSubscriptions": {
      "anyOf": [
        {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Activesubscriptions",
      "description": "List of active subscription product IDs (computed field, not stored in DB)"
    },
    "isPremium": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "title": "Ispremium",
      "description": "Indicates if the user has any active subscriptions (computed field, not stored in DB)"
    },
    "hasTriggeredSalesNotification": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "title": "Hastriggeredsalesnotification",
      "description": "Whether the user has triggered a sales notification on first launch",
      "default": false
    },
    "createdAt": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Createdat",
      "description": "Timestamp when the user was created"
    },
    "updatedAt": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Updatedat",
      "description": "Timestamp when the user was last updated"
    },
    "preferences": {
      "anyOf": [
        {
          "$ref": "#/$defs/UserPreferences"
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "type": "object",
  "required": [
    "providerId",
    "uid"
  ],
  "$defs": {
    "AUTH_PROVIDER": {
      "type": "string",
      "enum": [
        "firebase",
        "google",
        "apple"
      ],
      "title": "AUTH_PROVIDER"
    },
    "Gender": {
      "type": "string",
      "enum": [
        "male",
        "female"
      ],
      "title": "Gender",
      "description": "Gender values."
    },
    "UserPreferences": {
      "properties": {
        "hasConfirmedThirdPartyAI": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "title": "Hasconfirmedthirdpartyai"
        },
        "isSingularRevenueTracked": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "title": "Issingularrevenuetracked"
        },
        "countryCode": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Countrycode"
        },
        "notificationsEnabled": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "title": "Notificationsenabled"
        }
      },
      "type": "object",
      "title": "UserPreferences"
    },
    "UserSubscriptionSchema": {
      "properties": {
        "isActive": {
          "type": "boolean",
          "title": "Isactive"
        },
        "expiresAt": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "number"
            },
            {
              "type": "string"
            },
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Expiresat"
        },
        "productId": {
          "type": "string",
          "title": "Productid"
        },
        "transactionId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Transactionid"
        },
        "createdAt": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "number"
            },
            {
              "type": "string"
            },
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Createdat"
        },
        "updatedAt": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "number"
            },
            {
              "type": "string"
            },
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ],
          "title": "Updatedat"
        }
      },
      "type": "object",
      "required": [
        "isActive",
        "productId"
      ],
      "title": "UserSubscriptionSchema",
      "description": "Schema for current and legacy user subscription objects in Firestore."
    }
  }
}