/**
 * Shared TypeScript contracts for Studio API/UI communication.
 * Ported from PR #96 (Te9ui1a) — prevents client/server type drift.
 */
export interface HealthStatus {
    readonly status: "ok";
    readonly projectRoot: string;
    readonly projectConfigFound: boolean;
    readonly envFound: boolean;
    readonly projectEnvFound: boolean;
    readonly globalConfigFound: boolean;
    readonly bookCount: number;
    readonly provider: string | null;
    readonly model: string | null;
}
export interface BookSummary {
    readonly id: string;
    readonly title: string;
    readonly status: string;
    readonly platform: string;
    readonly genre: string;
    readonly targetChapters: number;
    readonly chapters: number;
    readonly chapterCount: number;
    readonly lastChapterNumber: number;
    readonly totalWords: number;
    readonly approvedChapters: number;
    readonly pendingReview: number;
    readonly pendingReviewChapters: number;
    readonly failedReview: number;
    readonly failedChapters: number;
    readonly recentRunStatus?: string | null;
    readonly updatedAt: string;
}
export interface BookDetail extends BookSummary {
    readonly createdAt: string;
    readonly chapterWordCount: number;
    readonly language: "zh" | "en" | null;
}
export interface ChapterSummary {
    readonly number: number;
    readonly title: string;
    readonly status: string;
    readonly wordCount: number;
    readonly auditIssueCount: number;
    readonly updatedAt: string;
    readonly fileName: string | null;
}
export interface ChapterDetail extends ChapterSummary {
    readonly auditIssues: ReadonlyArray<string>;
    readonly reviewNote?: string;
    readonly content: string;
}
export interface SaveChapterPayload {
    readonly content: string;
}
export interface TruthFileSummary {
    readonly name: string;
    readonly label: string;
    readonly exists: boolean;
    readonly path: string;
    readonly optional: boolean;
    readonly available: boolean;
}
export interface TruthFileDetail extends TruthFileSummary {
    readonly content: string | null;
}
export interface ReviewActionPayload {
    readonly chapterNumber: number;
    readonly reason?: string;
}
export type RunAction = "draft" | "audit" | "revise" | "write-next";
export type RunStatus = "queued" | "running" | "succeeded" | "failed";
export interface RunLogEntry {
    readonly timestamp: string;
    readonly level: "info" | "warn" | "error";
    readonly message: string;
}
export interface RunActionPayload {
    readonly chapterNumber?: number;
}
export interface StudioRun {
    readonly id: string;
    readonly bookId: string;
    readonly chapter: number | null;
    readonly chapterNumber: number | null;
    readonly action: RunAction;
    readonly status: RunStatus;
    readonly stage: string;
    readonly createdAt: string;
    readonly updatedAt: string;
    readonly startedAt: string | null;
    readonly finishedAt: string | null;
    readonly logs: ReadonlyArray<RunLogEntry>;
    readonly result?: unknown;
    readonly error?: string;
}
export interface RunStreamEvent {
    readonly type: "snapshot" | "status" | "stage" | "log";
    readonly runId: string;
    readonly run?: StudioRun;
    readonly status?: RunStatus;
    readonly stage?: string;
    readonly log?: RunLogEntry;
    readonly result?: unknown;
    readonly error?: string;
}
export interface ApiErrorResponse {
    readonly error: {
        readonly code: string;
        readonly message: string;
    };
}
export type StudioUserRole = "user" | "admin";
export interface StudioPublicUser {
    readonly id: string;
    readonly username: string;
    readonly role: StudioUserRole;
    readonly passwordResetRequired?: boolean;
}
export interface StudioQuotaSummary {
    readonly dailyChapterLimit: number;
    readonly chaptersUsedToday: number;
    readonly globalDailyChapterLimit?: number;
    readonly globalChaptersUsedToday?: number;
}
export interface AuthMeResponse {
    readonly user: StudioPublicUser;
    readonly quota: StudioQuotaSummary;
}
export interface AuthLoginPayload {
    readonly username: string;
    readonly password: string;
}
export interface AuthLoginResponse extends AuthMeResponse {
    readonly ok: true;
}
export interface AuthChangePasswordPayload {
    readonly currentPassword: string;
    readonly newPassword: string;
}
export type StudioJobStatus = "queued" | "running" | "paused_quota" | "completed" | "failed" | "cancelled";
export interface StudioJob {
    readonly id: string;
    readonly userId: string;
    readonly projectRoot: string;
    readonly type: "full_book_generation";
    readonly status: StudioJobStatus;
    readonly bookId: string;
    readonly title: string;
    readonly targetChapters: number;
    readonly chapterWordCount: number;
    readonly chaptersWritten: number;
    readonly queuePosition?: number;
    readonly error?: string;
    readonly createdAt: string;
    readonly updatedAt: string;
    readonly startedAt?: string;
    readonly completedAt?: string;
    readonly cancelledAt?: string;
}
export interface CreateBookQueuedResponse {
    readonly status: "queued";
    readonly jobId: string;
    readonly bookId: string;
}
export interface JobsListResponse {
    readonly jobs: readonly StudioJob[];
}
//# sourceMappingURL=contracts.d.ts.map