// Generated from openapi/openapi.json. Do not edit by hand.

export type AccountDeletionCompleteRequest = {
  "confirmation": "注销账号";
  "deletion_id": string;
  "verification_code": string;
};

export type AccountDeletionResponse = {
  "status": "deleted";
};

export type AccountDeletionSendResponse = {
  "challenge_expires_at": string;
  "deletion_id": string;
  "resend_available_at": string;
  "status": "verification_sent";
};

export type AccountProfileUpdateRequest = {
  "creator_name": string;
  "social_id": string;
};

export type AccountProfileUpdateResponse = {
  "profile": {
  "creator_name": string;
  "social_id": string;
};
  "status": "saved";
};

export type AccountSettingsResponse = {
  "account": {
  "email": string;
  "status": "active";
};
  "csrf_token": string;
  "local_data": {
  "backup_enabled": false;
  "capacity_status": "normal" | "warning" | "critical" | "full" | "unavailable";
  "hard_limit_bytes": number;
  "location": "configured_local_data_root";
  "managed_content_bytes": number;
  "migration_supported": false;
};
  "profile": {
  "creator_name": string;
  "social_id": string;
};
};

export type AdminAuditQuery = {
  "cursor"?: string;
  "limit"?: number;
};

export type AdminAuthenticatedUser = {
  "role": "super_admin";
  "status": "active";
  "user_id": string;
};

export type AdminCreditParams = {
  "userId": string;
};

export type AdminDiagnosticsResponse = {
  "diagnostic_text": string;
  "generated_at": string;
  "services": AdminServicesStorageResponse;
  "system": {
  "api_status": "ready" | "degraded" | "unavailable";
  "app_version": string;
  "browser_support": Array<{
  "brand": "Google Chrome" | "Microsoft Edge";
  "major": number;
}>;
  "worker_status": "ready" | "degraded" | "unavailable";
};
};

export type AdminGenerationListResponse = {
  "generated_at": string;
  "items": Array<AdminGenerationRecord>;
};

export type AdminGenerationRecord = {
  "completed_at": string | null;
  "confirmed_credit_cost": number;
  "created_at": string;
  "duration_ms": number | null;
  "error_category": "upstream_timeout" | "upstream_failed" | "safety_rejected" | "model_disabled" | "gateway_balance_insufficient" | "gateway_contract_invalid" | "reference_invalid" | "unknown_retryable" | "unknown_non_retryable" | null;
  "final_credit_state": "committed" | "released" | null;
  "generation_id": string;
  "model_id": string;
  "owner_ref": string;
  "project_id": string;
  "ratio": "3:4" | "1:1" | "4:3" | "9:16";
  "reserved_credits": number;
  "status": "queued" | "running" | "succeeded" | "failed" | "rejected";
};

export type AdminLoginCompleteRequest = {
  "registration_id": string;
  "verification_code": string;
};

export type AdminLoginCompleteResponse = {
  "admin": AdminAuthenticatedUser;
  "audience": "admin";
  "session_expires_at": string;
  "status": "authenticated";
};

export type AdminLoginSendRequest = {
  "email": string;
};

export type AdminOperationAuditItem = {
  "actor_ref": string;
  "actor_type": "system" | "super_admin";
  "after_summary": string | null;
  "before_summary": string | null;
  "expires_at": string;
  "log_id": string;
  "occurred_at": string;
  "operation_type": string;
  "result": "succeeded" | "failed";
  "target_ref": string;
  "target_type": string;
};

export type AdminOperationAuditResponse = {
  "generated_at": string;
  "items": Array<AdminOperationAuditItem>;
  "next_cursor": string | null;
};

export type AdminOverviewResponse = {
  "asset_cleanup": {
  "pending_jobs": number;
};
  "generated_at": string;
  "generation_jobs": {
  "pending_manual_review": number;
  "pending_manual_review_oldest_at": string | null;
  "queued": number;
  "running": number;
};
  "models": {
  "configured_default_model_id": string | null;
  "configured_model_count": number;
  "recommended_model_id": string | null;
  "runtime_available_count": number;
};
  "recent_operations": Array<{
  "created_at": string;
  "operation_id": string;
  "operation_type": string;
  "result": "succeeded" | "rejected" | "failed";
  "target_ref": string;
}>;
  "services": Array<{
  "checked_at": string | null;
  "service_id": "resend" | "amap" | "ai_gateway" | "worker" | "asset_root";
  "status": "available" | "degraded" | "paused" | "unavailable";
}>;
  "storage": {
  "last_measured_at": string | null;
  "limit_bytes": number;
  "managed_content_bytes": number;
  "status": "normal" | "critical" | "full" | "unavailable";
};
  "user_slots": {
  "active_and_suspended": number;
  "limit": number;
};
};

export type AdminServiceHealthCheckRequest = {
  "available": boolean;
  "reason"?: string;
};

export type AdminServiceLimitRequest = {
  "hard_limit": number;
  "period_type": ExternalServicePeriodType;
};

export type AdminServiceParams = {
  "service_id": ExternalServiceId;
};

export type AdminServiceRecoveryRequest = {
  "check_id": string;
};

export type AdminServicesResponse = {
  "services": Array<ExternalServiceUsage>;
};

export type AdminServicesStorageResponse = {
  "generated_at": string;
  "services": Array<{
  "checked_at": string | null;
  "configured": boolean;
  "impact_scope": "none" | "authentication" | "location" | "generation" | "storage" | "api" | "model" | "account" | "unknown";
  "pause_reason": string | null;
  "service_id": "resend" | "amap" | "ai_gateway" | "worker" | "api" | "asset_root";
  "status": "active" | "paused_quota" | "paused_provider" | "disabled" | "degraded" | "unavailable";
}>;
  "storage": {
  "capacity_notice_level": "normal" | "warning" | "critical";
  "cleanup_pending_count": number;
  "data_root_ref": "configured_local_data_root";
  "hard_limit_bytes": number;
  "last_measured_at": string | null;
  "managed_content_bytes": number;
  "remeasurement_required": boolean;
  "status": "active" | "full" | "unavailable";
  "storage_backend": "local_filesystem";
};
};

export type AdminSessionResponse = {
  "acknowledged_private_content_notice_version": string | null;
  "admin": AdminAuthenticatedUser;
  "audience": "admin";
  "authenticated": true;
  "csrf_token": string;
  "current_private_content_notice_message_key"?: string;
  "current_private_content_notice_version": string | null;
  "expires_at": string;
  "notice_acknowledged": boolean;
};

export type AuthenticatedUser = {
  "creator_name": string;
  "role": "user";
  "social_id": string;
  "status": "active";
  "user_id": string;
};

export type BootstrapResponse = {
  "app_version": string;
  "dependencies": Array<{
  "service_id": string;
  "status": "available" | "paused" | "degraded" | "unavailable";
}>;
  "model_summary": {
  "config_set_version": number | null;
  "configured_default_model_id": string | null;
  "recommended_model_id": string | null;
  "runtime_availability_version": number | null;
};
  "public_features": Array<{
  "feature_id": string;
  "status": "enabled" | "disabled" | "paused";
}>;
};

export type BrowserSupportRequest = {
  "brands": Array<{
  "brand": string;
  "version": string;
}>;
  "full_version_list": Array<{
  "brand": string;
  "version": string;
}>;
  "platform": string;
};

export type BrowserSupportSuccess = {
  "app_version": string;
  "browser": {
  "brand": "Google Chrome" | "Microsoft Edge";
  "major": number;
};
  "status": "supported";
  "supported_browsers": Array<{
  "brand": "Google Chrome" | "Microsoft Edge";
  "major": number;
}>;
};

export type BrowserUnsupportedReason = "platform_unsupported" | "brand_unsupported" | "version_unsupported" | "identity_unavailable";

export type CanvasBackgroundAdjustments = {
  "brightness": number;
  "contrast": number;
  "crop": {
  "height": number;
  "width": number;
  "x": number;
  "y": number;
} | null;
  "filter": string;
  "fit": "fill" | "fit" | "crop";
  "saturation": number;
  "sharpness": number;
  "temperature": number;
};

export type CanvasElement = {
  "colors"?: Array<string>;
  "content"?: string;
  "coordinates"?: {
  "latitude": number;
  "longitude": number;
};
  "created_at": string;
  "dynamic_fields"?: Record<string, string | number | boolean | null>;
  "element_id": string;
  "font_override"?: string;
  "font_size"?: number;
  "formatted_value"?: string;
  "opacity": number;
  "position": {
  "x": number;
  "y": number;
};
  "resource_version": string;
  "rotation": number;
  "scale": {
  "x": number;
  "y": number;
};
  "style_id"?: string;
  "style_parameters"?: Record<string, string | number | boolean | null>;
  "template_or_asset_id": string;
  "type": "text_template" | "static_sticker" | "color_card" | "dynamic_sticker";
  "z_index": number;
};

export type CanvasState = {
  "background": {
  "adjustments": CanvasBackgroundAdjustments;
  "asset_id": string | null;
};
  "elements": Array<CanvasElement>;
  "pixel_height": number;
  "pixel_width": number;
  "ratio": "3:4" | "1:1" | "4:3" | "9:16";
  "schema_version": 1;
};

export type CorrelationId = string;

export type CreditAdjustmentHeaders = {
  "idempotency-key": string;
  "x-csrf-token": string;
};

export type CreditAdjustmentRequest = {
  "adjustment_id": string;
  "amount": number | number;
  "reason": string;
};

export type CreditAdjustmentResponse = {
  "adjustment_id": string;
  "available_balance": number;
  "reserved_balance": number;
  "status": "adjusted";
};

export type CreditBalanceResponse = {
  "available_balance": number;
  "reserved_balance": number;
  "updated_at": string;
};

export type CreditEntryStatus = "succeeded" | "frozen" | "committed" | "released";

export type CreditEntryType = "registration_grant" | "generation_reserve" | "generation_commit" | "generation_release" | "admin_adjustment";

export type CreditLedgerEntry = {
  "amount": number;
  "available_after": number;
  "available_before": number;
  "created_at": string;
  "entry_id": string;
  "entry_type": CreditEntryType;
  "model_id": string | null;
  "reason": string | null;
  "reference_id": string | null;
  "reference_type": CreditReferenceType | null;
  "reserved_after": number;
  "reserved_before": number;
  "status": CreditEntryStatus;
};

export type CreditLedgerQuery = {
  "cursor"?: string;
  "event_type"?: CreditEntryType;
  "from"?: string;
  "limit"?: number;
  "to"?: string;
};

export type CreditLedgerResponse = {
  "credits": CreditSummary;
  "entries": Array<CreditLedgerEntry>;
  "next_cursor": string | null;
  "updated_at": string;
};

export type CreditReferenceType = "registration" | "generation" | "admin_adjustment";

export type CreditSummary = {
  "available_balance": number;
  "reserved_balance": number;
};

export type CsrfHeaders = {
  "x-csrf-token": string;
};

export type ErrorDetails = {
  "capacity_status"?: "normal" | "warning" | "critical" | "full" | "unavailable";
  "conflict_model_ids"?: Array<string>;
  "current_task_ref"?: string;
  "field_errors"?: Array<{
  "field": string;
  "message_key": string;
}>;
  "latest_version"?: number | string;
  "reason"?: "platform_unsupported" | "brand_unsupported" | "version_unsupported" | "identity_unavailable";
  "remaining_bytes"?: number;
  "supported_browsers"?: Array<{
  "brand": "Google Chrome" | "Microsoft Edge";
  "major": number;
}>;
};

export type ErrorEnvelope = {
  "error": {
  "code": "BROWSER_UNSUPPORTED" | "MODEL_CONFIG_VERSION_CONFLICT" | "MODEL_DEFAULT_REPLACEMENT_REQUIRED" | "MODEL_DEFAULT_REPLACEMENT_INVALID" | "MODEL_RECOMMENDATION_PRIORITY_INVALID" | "MODEL_RECOMMENDATION_PRIORITY_CONFLICT" | "PRIVATE_CONTENT_NOTICE_ACK_REQUIRED" | "ASSET_HISTORY_REFERENCE_CONFLICT" | "ASSET_CLEANUP_CANDIDATE_STALE" | "STORAGE_CAPACITY_EXCEEDED" | "REGISTRATION_REJECTED" | "REGISTRATION_REQUEST_INVALID" | "IDEMPOTENCY_KEY_CONFLICT" | "AUTH_SESSION_INVALID" | "AUTH_SERVICE_UNAVAILABLE" | "AUTH_ENTRY_REJECTED" | "AUTH_RATE_LIMITED" | "AUTH_CSRF_INVALID";
  "correlation_id": string;
  "details": {
  "capacity_status"?: "normal" | "warning" | "critical" | "full" | "unavailable";
  "conflict_model_ids"?: Array<string>;
  "current_task_ref"?: string;
  "field_errors"?: Array<{
  "field": string;
  "message_key": string;
}>;
  "latest_version"?: number | string;
  "reason"?: "platform_unsupported" | "brand_unsupported" | "version_unsupported" | "identity_unavailable";
  "remaining_bytes"?: number;
  "supported_browsers"?: Array<{
  "brand": "Google Chrome" | "Microsoft Edge";
  "major": number;
}>;
};
  "error_category"?: "upstream_timeout" | "upstream_failed" | "safety_rejected" | "model_disabled" | "gateway_balance_insufficient" | "gateway_contract_invalid" | "reference_invalid" | "unknown_retryable" | "unknown_non_retryable";
  "message_key": string;
};
};

export type ExportFormat = "jpg" | "png";

export type ExternalServiceId = "resend_email" | "amap_web_service";

export type ExternalServicePeriodType = "daily" | "monthly";

export type ExternalServiceStatus = "active" | "paused_quota" | "paused_provider" | "disabled";

export type ExternalServiceUsage = {
  "hard_limit": number;
  "pause_reason": string | null;
  "period_start": string;
  "period_type": ExternalServicePeriodType;
  "service_id": ExternalServiceId;
  "service_status": ExternalServiceStatus;
  "updated_at": string;
  "used_count": number;
};

export type FailedEmptyTrashRequest = {
  "project_ids": Array<ProjectId>;
};

export type FailedEmptyTrashResponse = {
  "ignored_project_ids": Array<ProjectId>;
  "trashed_project_ids": Array<ProjectId>;
};

export type GenerationCreateHeaders = {
  "idempotency-key": string;
  "x-csrf-token": string;
};

export type GenerationCreateResponse = {
  "created": boolean;
  "task": GenerationTaskResponse;
};

export type GenerationErrorCategory = "upstream_timeout" | "upstream_failed" | "safety_rejected" | "model_disabled" | "gateway_balance_insufficient" | "gateway_contract_invalid" | "reference_invalid" | "unknown_retryable" | "unknown_non_retryable";

export type GenerationMultipartBody = {
  "client_submission_id": string;
  "confirmed_credit_cost": string;
  "creation_mode": "new_project" | "existing_project";
  "existing_reference_asset_ids"?: string;
  "model_config_version": string;
  "model_id": string;
  "project_id"?: string;
  "prompt": string;
  "ratio": ProjectRatio;
  "reference_files"?: Array<string>;
  "reference_manifest"?: string;
};

export type GenerationParams = {
  "generationId": string;
};

export type GenerationProjectItem = {
  "created_at": string;
  "error_category": GenerationErrorCategory | null;
  "generation_id": string;
  "prompt": string;
  "ratio": ProjectRatio;
  "status": "queued" | "running" | "succeeded" | "failed" | "rejected";
  "updated_at": string;
};

export type GenerationTaskResponse = {
  "confirmed_credit_cost": number;
  "created_at": string;
  "error_category": GenerationErrorCategory | null;
  "generation_id": string;
  "model_config_version": number;
  "model_id": string;
  "project_id": ProjectId;
  "prompt": string;
  "ratio": ProjectRatio;
  "reference_asset_ids": Array<string>;
  "reference_count": number;
  "reserved_credits": number;
  "status": GenerationTaskStatus;
  "updated_at": string;
};

export type GenerationTaskStatus = "queued" | "running" | "succeeded" | "failed" | "rejected";

export type LatestExportItem = {
  "byte_size": number;
  "created_at": string;
  "download_url": string;
  "export_id": string;
  "format": ExportFormat;
  "pixel_height": number;
  "pixel_width": number;
  "sha256": string;
  "state_version": number;
};

export type LatestExportMultipartBody = {
  "byte_size": string;
  "export_file": string;
  "export_id": string;
  "format": ExportFormat;
  "pixel_height": string;
  "pixel_width": string;
  "sha256": string;
  "state_version": string;
};

export type LatestExportParams = {
  "format": ExportFormat;
  "projectId": ProjectId;
};

export type LatestExportSaveResponse = {
  "byte_size": number;
  "created_at": string;
  "download_url": string;
  "export_id": string;
  "format": ExportFormat;
  "pixel_height": number;
  "pixel_width": number;
  "sha256": string;
  "state_version": number;
  "status": "saved";
};

export type LoginCompleteRequest = {
  "registration_id": string;
  "verification_code": string;
};

export type LoginCompleteResponse = {
  "audience": "user";
  "credits": CreditSummary;
  "session_expires_at": string;
  "status": "authenticated";
  "user": AuthenticatedUser;
};

export type LoginSendRequest = {
  "email": string;
};

export type LogoutHeaders = {
  "idempotency-key": string;
  "x-csrf-token": string;
};

export type LogoutResponse = {
  "status": "logged_out";
};

export type ModelConfig = {
  "config_version": number;
  "contract_evidence_ref": string | null;
  "contract_validation_status": ModelContractValidationStatus;
  "credit_cost": number;
  "display_name": string;
  "enabled": boolean;
  "error_mapping_profile": Record<string, string>;
  "gateway_account_ref": string;
  "is_default": boolean;
  "model_id": ModelId;
  "prompt_max_length": number;
  "recommendation_priority": number;
  "reference_limits": ModelReferenceLimits;
  "route_profile": Record<string, unknown>;
  "runtime_availability": ModelRuntimeAvailability;
  "safety_source": string;
  "supported_ratios": Array<string>;
};

export type ModelConfigCandidate = {
  "credit_cost": number;
  "display_name": string;
  "enabled": boolean;
  "error_mapping_profile": Record<string, string>;
  "gateway_account_ref": string;
  "is_default": boolean;
  "model_id": ModelId;
  "prompt_max_length": number;
  "recommendation_priority": number;
  "reference_limits": ModelReferenceLimits;
  "route_profile": Record<string, unknown>;
  "safety_source": string;
  "supported_ratios": Array<string>;
};

export type ModelConfigSseEvent = {
  "config_set_version": number;
  "entity_ref": string;
  "event_id": number;
  "event_type": "model_config_changed";
  "occurred_at": string;
};

export type ModelConfigUpdateHeaders = {
  "idempotency-key": string;
  "x-csrf-token": string;
};

export type ModelConfigUpdateRequest = {
  "expected_config_set_version": number;
  "models": Array<ModelConfigCandidate>;
};

export type ModelConfigurationResponse = {
  "config_set_version": number;
  "configured_default_model_id": ModelId;
  "models": Array<ModelConfig>;
  "recommended_model_id": ModelId | null;
};

export type ModelContractValidationStatus = "blocked" | "unverified" | "verified";

export type ModelId = string;

export type ModelParams = {
  "model_id": ModelId;
};

export type ModelReferenceLimits = {
  "max_file_bytes": number;
  "max_files": number;
  "max_total_bytes": number;
};

export type ModelRuntimeAvailability = {
  "available_for_new_jobs": boolean;
  "checked_at": string;
  "reason": ModelRuntimeReason;
};

export type ModelRuntimeReason = "available" | "configured_disabled" | "contract_unverified" | "contract_blocked" | "gateway_balance_insufficient" | "gateway_paused" | "worker_degraded";

export type ModelRuntimeSseEvent = {
  "entity_ref": string;
  "event_id": number;
  "event_type": "model_runtime_changed";
  "occurred_at": string;
  "runtime_availability_version": number;
};

export type PrivateContentAccessAuditItem = {
  "actor_ref": string;
  "content_type": "image" | "prompt";
  "expires_at": string;
  "log_id": string;
  "occurred_at": string;
  "target_ref": string;
};

export type PrivateContentAccessAuditResponse = {
  "generated_at": string;
  "items": Array<PrivateContentAccessAuditItem>;
  "next_cursor": string | null;
};

export type PrivateContentGenerationParams = {
  "generationId": string;
};

export type PrivateContentNoticeAckRequest = {
  "expected_notice_version": string;
};

export type PrivateContentNoticeAckResponse = {
  "acknowledged_at": string;
  "notice_version": string;
  "status": "acknowledged";
};

export type PrivateContentPromptResponse = {
  "content_type": "prompt";
  "generation_id": string;
  "prompt": string;
};

export type ProjectDetailResponse = {
  "canvas_state": CanvasState;
  "created_at": string;
  "current_image_id": ProjectId | null;
  "deleted_at": string | null;
  "draft_prompt": string;
  "generations": Array<GenerationProjectItem>;
  "images": Array<ProjectImageItem>;
  "latest_exports": Array<LatestExportItem>;
  "name": string;
  "pixel_height": number;
  "pixel_width": number;
  "project_id": ProjectId;
  "purge_at": string | null;
  "ratio": ProjectRatio;
  "save_status": "saved";
  "state_version": number;
  "status": ProjectViewStatus;
  "successful_image_count": number;
  "updated_at": string;
};

export type ProjectEditableState = {
  "canvas_state": CanvasState;
  "name": string;
};

export type ProjectId = string;

export type ProjectImageItem = {
  "created_at": string;
  "generation_id": string;
  "image_id": ProjectId;
};

export type ProjectImageParams = {
  "imageId": ProjectId;
  "projectId": ProjectId;
};

export type ProjectListQuery = {
  "status"?: "active" | "trashed";
};

export type ProjectListResponse = {
  "active_count": number;
  "active_limit": 20;
  "projects": Array<ProjectSummary>;
};

export type ProjectParams = {
  "projectId": ProjectId;
};

export type ProjectPurgeResponse = {
  "project_id": ProjectId;
  "status": "purged";
};

export type ProjectRatio = "3:4" | "1:1" | "4:3" | "9:16";

export type ProjectRenameRequest = {
  "name": string;
};

export type ProjectRenameResponse = {
  "name": string;
  "state_version": number;
  "status": "renamed";
};

export type ProjectRestoreResponse = {
  "deleted_at": null;
  "project_id": ProjectId;
  "purge_at": null;
  "status": "active";
};

export type ProjectStateConflictResponse = {
  "latest_state_version": number;
  "save_status": "conflicted";
};

export type ProjectStateSaveHeaders = {
  "idempotency-key": string;
  "if-match": string;
  "x-csrf-token": string;
};

export type ProjectStateSaveResponse = {
  "save_status": "saved";
  "state_version": number;
};

export type ProjectSummary = {
  "current_image_id": ProjectId | null;
  "deleted_at": string | null;
  "name": string;
  "project_id": ProjectId;
  "purge_at": string | null;
  "ratio": ProjectRatio;
  "state_version": number;
  "status": ProjectViewStatus;
  "successful_image_count": number;
  "updated_at": string;
};

export type ProjectTrashResponse = {
  "deleted_at": string;
  "project_id": ProjectId;
  "purge_at": string;
  "status": "trashed";
};

export type ProjectViewStatus = "active" | "failed_empty" | "trashed";

export type RecentAssetItem = {
  "asset_id": string;
  "asset_kind": RecentAssetKind;
  "resource_version": string;
};

export type RecentAssetKind = "static_sticker" | "text_template";

export type RecentAssetListResponse = {
  "items": Array<RecentAssetItem>;
};

export type RecentAssetQuery = {
  "asset_kind": RecentAssetKind;
};

export type RecentAssetRecordRequest = {
  "asset_id": string;
  "asset_kind": RecentAssetKind;
  "resource_version": string;
};

export type RecentAssetRecordResponse = {
  "status": "recorded";
};

export type RegistrationCompleteHeaders = {
  "idempotency-key": string;
};

export type RegistrationCompleteRequest = {
  "creator_name": string;
  "privacy_consent_accepted": boolean;
  "privacy_notice_version": string;
  "registration_id": string;
  "social_id": string;
  "verification_code": string;
};

export type RegistrationCompleteResponse = {
  "credits": CreditSummary;
  "session_expires_at": string;
  "status": "registered";
  "user": AuthenticatedUser;
};

export type RegistrationSendRequest = {
  "email": string;
  "invite_code": string;
};

export type RegistrationSendResponse = {
  "challenge_expires_at": string;
  "registration_id": string;
  "resend_available_at": string;
  "status": "verification_sent";
};

export type ReverseGeocodeRequest = {
  "latitude": number;
  "longitude": number;
};

export type ReverseGeocodeResponse = {
  "formatted_value": string;
  "service_mode": "mock" | "real";
  "status": "resolved";
};

export type SseEvent = {
  "entity_ref": string;
  "event_id": number;
  "event_type": string;
  "occurred_at": string;
  "state_version": number;
} | {
  "config_set_version": number;
  "entity_ref": string;
  "event_id": number;
  "event_type": "model_config_changed";
  "occurred_at": string;
} | {
  "entity_ref": string;
  "event_id": number;
  "event_type": "model_runtime_changed";
  "occurred_at": string;
  "runtime_availability_version": number;
};

export type StableEngineeringErrorCode = "BROWSER_UNSUPPORTED" | "MODEL_CONFIG_VERSION_CONFLICT" | "MODEL_DEFAULT_REPLACEMENT_REQUIRED" | "MODEL_DEFAULT_REPLACEMENT_INVALID" | "MODEL_RECOMMENDATION_PRIORITY_INVALID" | "MODEL_RECOMMENDATION_PRIORITY_CONFLICT" | "PRIVATE_CONTENT_NOTICE_ACK_REQUIRED" | "ASSET_HISTORY_REFERENCE_CONFLICT" | "ASSET_CLEANUP_CANDIDATE_STALE" | "STORAGE_CAPACITY_EXCEEDED" | "REGISTRATION_REJECTED" | "REGISTRATION_REQUEST_INVALID" | "IDEMPOTENCY_KEY_CONFLICT" | "AUTH_SESSION_INVALID" | "AUTH_SERVICE_UNAVAILABLE" | "AUTH_ENTRY_REJECTED" | "AUTH_RATE_LIMITED" | "AUTH_CSRF_INVALID";

export type StateSseEvent = {
  "entity_ref": string;
  "event_id": number;
  "event_type": string;
  "occurred_at": string;
  "state_version": number;
};

export type UserSessionResponse = {
  "audience": "user";
  "authenticated": true;
  "credits": CreditSummary;
  "csrf_token": string;
  "expires_at": string;
  "user": AuthenticatedUser;
};
