export type PuzzleClearGenerationStatus = 'draft' | 'generating' | 'ready' | 'failed'; export type PuzzleClearShapeKind = '1x2' | '1x3' | '2x2' | '2x3'; export type PuzzleClearOrientation = 'horizontal' | 'vertical'; export type PuzzleClearRunStatus = | 'playing' | 'level_failed' | 'level_cleared' | 'finished'; export type PuzzleClearActionType = | 'compile-draft' | 'regenerate-atlas' | 'update-work-meta' | 'update-board-background'; export interface PuzzleClearImageAsset { assetId: string; imageSrc: string; imageObjectKey: string; assetObjectId: string; generationProvider: string; prompt: string; width: number; height: number; } export interface PuzzleClearPatternGroup { groupId: string; shape: PuzzleClearShapeKind; width: number; height: number; atlasX: number; atlasY: number; atlasWidth: number; atlasHeight: number; } export interface PuzzleClearCardAsset { cardId: string; groupId: string; shape: PuzzleClearShapeKind; orientation: PuzzleClearOrientation; partX: number; partY: number; imageSrc: string; imageObjectKey: string; assetObjectId: string; sourceAtlasCell: string; } export interface PuzzleClearWorkspaceCreateRequest { templateId: 'puzzle-clear' | string; workTitle: string; workDescription: string; themePrompt: string; boardBackgroundPrompt: string; generateBoardBackground: boolean; boardBackgroundAsset?: PuzzleClearImageAsset | null; } export interface PuzzleClearActionRequest { actionType: PuzzleClearActionType; profileId?: string | null; workTitle?: string | null; workDescription?: string | null; themePrompt?: string | null; boardBackgroundPrompt?: string | null; generateBoardBackground?: boolean | null; boardBackgroundAsset?: PuzzleClearImageAsset | null; atlasAsset?: PuzzleClearImageAsset | null; patternGroups?: PuzzleClearPatternGroup[] | null; cardAssets?: PuzzleClearCardAsset[] | null; } export interface PuzzleClearDraftResponse { templateId: string; templateName: string; profileId: string | null; workTitle: string; workDescription: string; themePrompt: string; boardBackgroundPrompt: string; generateBoardBackground: boolean; boardBackgroundAsset: PuzzleClearImageAsset | null; cardBackImageSrc: string | null; atlasAsset: PuzzleClearImageAsset | null; patternGroups: PuzzleClearPatternGroup[]; cardAssets: PuzzleClearCardAsset[]; generationStatus: PuzzleClearGenerationStatus; } export interface PuzzleClearSessionSnapshotResponse { sessionId: string; ownerUserId: string; status: PuzzleClearGenerationStatus; draft: PuzzleClearDraftResponse | null; createdAt: string; updatedAt: string; } export interface PuzzleClearSessionResponse { session: PuzzleClearSessionSnapshotResponse; } export interface PuzzleClearActionResponse { actionType: PuzzleClearActionType; session: PuzzleClearSessionSnapshotResponse; work: PuzzleClearWorkProfileResponse | null; } export interface PuzzleClearWorkSummaryResponse { runtimeKind: 'puzzle-clear'; workId: string; profileId: string; ownerUserId: string; sourceSessionId: string | null; workTitle: string; workDescription: string; themePrompt: string; coverImageSrc: string | null; publicationStatus: string; playCount: number; updatedAt: string; publishedAt: string | null; publishReady: boolean; generationStatus: PuzzleClearGenerationStatus; } export interface PuzzleClearWorkProfileResponse { summary: PuzzleClearWorkSummaryResponse; draft: PuzzleClearDraftResponse; boardBackgroundAsset: PuzzleClearImageAsset | null; atlasAsset: PuzzleClearImageAsset; patternGroups: PuzzleClearPatternGroup[]; cardAssets: PuzzleClearCardAsset[]; } export interface PuzzleClearWorksResponse { items: PuzzleClearWorkSummaryResponse[]; } export interface PuzzleClearWorkDetailResponse { item: PuzzleClearWorkProfileResponse; } export interface PuzzleClearWorkMutationResponse { item: PuzzleClearWorkProfileResponse; } export interface PuzzleClearGalleryCardResponse extends PuzzleClearWorkSummaryResponse { publicWorkCode?: string; authorDisplayName?: string; recentPlayCount7d?: number; } export interface PuzzleClearGalleryResponse { items: PuzzleClearGalleryCardResponse[]; hasMore: boolean; nextCursor: string | null; } export interface PuzzleClearGalleryDetailResponse { item: PuzzleClearWorkProfileResponse; } export interface PuzzleClearBoardCell { row: number; col: number; card: PuzzleClearCardAsset | null; lockedGroupId: string | null; } export interface PuzzleClearBoardSnapshot { rows: number; cols: number; cells: PuzzleClearBoardCell[]; } export interface PuzzleClearRuntimeSnapshotResponse { runId: string; profileId: string; ownerUserId: string; runtimeMode?: 'draft' | 'published'; status: PuzzleClearRunStatus; levelIndex: number; clearsDone: number; targetClears: number; levelDurationSeconds: number; levelStartedAtMs: number; board: PuzzleClearBoardSnapshot; readyColumns: PuzzleClearCardAsset[][]; startedAtMs: number; finishedAtMs: number | null; } export interface PuzzleClearRunResponse { run: PuzzleClearRuntimeSnapshotResponse; } export interface PuzzleClearStartRunRequest { profileId: string; } export interface PuzzleClearSwapRequest { fromRow: number; fromCol: number; toRow: number; toCol: number; clientActionId: string; } export interface PuzzleClearRetryLevelRequest { clientActionId: string; } export interface PuzzleClearNextLevelRequest { clientActionId: string; } export interface PuzzleClearTimeUpRequest { clientActionId: string; }