68 lines
1.4 KiB
TypeScript
68 lines
1.4 KiB
TypeScript
export type GenerateType = 'UNKNOWN' | 'IMAGE' | 'VIDEO' | 'TEXT';
|
|
|
|
export type GenerationStatus = 'pending' | 'running' | 'completed' | 'failed';
|
|
|
|
export interface TemplateGeneration {
|
|
id: string;
|
|
userId: string;
|
|
templateId: string;
|
|
type: GenerateType;
|
|
resultUrl: string[];
|
|
status: GenerationStatus;
|
|
creditsCost?: number;
|
|
creditsTransactionId?: string;
|
|
createdAt: string;
|
|
updatedAt: string;
|
|
}
|
|
|
|
export interface TemplateGenerationResponse {
|
|
success: boolean;
|
|
data: TemplateGeneration;
|
|
}
|
|
|
|
export interface RunTemplateResponse {
|
|
success: boolean;
|
|
data: string; // generation ID
|
|
}
|
|
|
|
export interface FormFieldOption {
|
|
label: string;
|
|
value: string | number;
|
|
}
|
|
|
|
export interface FormFieldSchema {
|
|
name: string;
|
|
label: string;
|
|
type: 'text' | 'number' | 'textarea' | 'select' | 'image' | 'video' | 'color';
|
|
required?: boolean;
|
|
placeholder?: string;
|
|
options?: FormFieldOption[];
|
|
min?: number;
|
|
max?: number;
|
|
defaultValue?: any;
|
|
description?: string;
|
|
}
|
|
|
|
export interface RunFormSchema {
|
|
fields: FormFieldSchema[];
|
|
validation?: {
|
|
[fieldName: string]: {
|
|
required?: boolean;
|
|
min?: number;
|
|
max?: number;
|
|
pattern?: string;
|
|
message?: string;
|
|
};
|
|
};
|
|
}
|
|
|
|
export interface RunTemplateData {
|
|
[fieldName: string]: any;
|
|
}
|
|
|
|
export interface RunProgress {
|
|
status: GenerationStatus;
|
|
progress: number; // 0-100
|
|
message: string;
|
|
result?: TemplateGeneration;
|
|
} |