{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/medianfi-com/json-schema/medianfi-com-auth-response-schema.json",
  "title": "AuthResponse",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/medianfi-com-auth-api-openapi.yml#/components/schemas/AuthResponse",
  "type": "object",
  "properties": {
    "success": {
      "type": "boolean"
    },
    "data": {
      "type": "object",
      "properties": {
        "user": {
          "$ref": "#/$defs/User"
        },
        "accessToken": {
          "type": "string"
        },
        "refreshToken": {
          "type": "string"
        },
        "expiresIn": {
          "type": "integer",
          "description": "Access token TTL in seconds"
        },
        "companyId": {
          "type": [
            "string",
            "null"
          ],
          "description": "Primary company for customer-app session routing"
        },
        "canSeeInternalUi": {
          "type": "boolean",
          "description": "True when the primary company is allowlisted for customer-app preview UI"
        },
        "memberships": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/UserContextMembership"
          }
        }
      }
    }
  },
  "$defs": {
    "User": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid"
        },
        "email": {
          "type": "string",
          "format": "email"
        },
        "name": {
          "type": "string"
        },
        "phone": {
          "type": [
            "string",
            "null"
          ]
        },
        "jobTitle": {
          "type": [
            "string",
            "null"
          ]
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "UserContextMembership": {
      "type": "object",
      "properties": {
        "companyId": {
          "type": "string",
          "format": "uuid"
        },
        "companyName": {
          "type": [
            "string",
            "null"
          ]
        },
        "role": {
          "type": "string",
          "enum": [
            "owner",
            "admin",
            "cfo",
            "member",
            "viewer"
          ]
        }
      }
    }
  }
}