o2o-castad-frontend/src/types/api.ts

207 lines
4.2 KiB
TypeScript

export interface CrawlingResponse {
image_list: string[];
image_count: number;
processed_info: {
customer_name: string;
region: string;
detail_region_info: string;
};
marketing_analysis: {
report: string;
tags: string[];
facilities: string[];
};
}
// URL 이미지 (서버에서 가져온 이미지)
export interface UrlImage {
type: 'url';
url: string;
}
// 업로드된 파일 이미지
export interface FileImage {
type: 'file';
file: File;
preview: string; // createObjectURL로 생성된 미리보기 URL
}
export type ImageItem = UrlImage | FileImage;
// 가사 생성 요청
export interface LyricGenerateRequest {
customer_name: string;
detail_region_info: string;
language: string;
region: string;
task_id: string;
}
// 가사 생성 응답
export interface LyricGenerateResponse {
success: boolean;
task_id: string;
lyric?: string;
language?: string;
prompt_used?: string;
error_message: string | null;
}
// 가사 상태 조회 응답
export interface LyricStatusResponse {
message: string;
status: 'processing' | 'completed' | 'failed';
task_id: string;
lyric?: string;
error_message?: string | null;
}
// 가사 상세 조회 응답
export interface LyricDetailResponse {
id: number;
task_id: string;
project_id: number;
status: string;
lyric_prompt: string;
lyric_result: string;
created_at: string;
}
// 노래 생성 요청
export interface SongGenerateRequest {
genre: string;
language: string;
lyrics: string;
}
// 노래 생성 응답
export interface SongGenerateResponse {
success: boolean;
task_id: string;
song_id: string;
message: string;
error_message: string | null;
}
// 노래 다운로드 상태 조회 응답 (DB Polling)
export interface SongDownloadResponse {
success: boolean;
status: string;
message: string;
store_name: string;
region: string;
detail_region_info: string;
task_id: string;
language: string;
song_result_url: string;
created_at: string;
error_message: string | null;
}
// 영상 생성 응답
export interface VideoGenerateResponse {
success: boolean;
task_id: string;
creatomate_render_id: string
message: string;
error_message: string | null;
}
// 영상 상태 확인 응답
export interface VideoStatusResponse {
success: boolean;
status: string;
message: string;
render_data: {
id: string;
status: string;
url: string | null;
snapshot_url: string | null;
} | null;
raw_response?: Record<string, unknown>;
error_message: string | null;
}
// 영상 다운로드(결과 조회) 응답
export interface VideoDownloadResponse {
success: boolean;
status: string;
message: string;
store_name: string;
region: string;
task_id: string;
result_movie_url: string | null;
created_at: string;
error_message: string | null;
}
// 이미지 업로드 요청용 URL 이미지 정보
export interface ImageUrlItem {
url: string;
name?: string;
}
// 이미지 업로드 응답
export interface ImageUploadResponse {
task_id: string;
file_count: number;
image_urls: string[];
images: Array<{
id: number;
img_name: string;
img_order: number;
img_url: string;
source: string;
}>;
}
// 언어 매핑
export const LANGUAGE_MAP: Record<string, string> = {
'한국어': 'Korean',
'English': 'English',
'中文': 'Chinese',
'日本語': 'Japanese',
'ไทย': 'Thai',
'Tiếng Việt': 'Vietnamese',
};
// 카카오 로그인 URL 응답
export interface KakaoLoginUrlResponse {
auth_url: string;
}
// 카카오 콜백 사용자 정보
export interface KakaoCallbackUser {
id: number;
nickname: string;
email: string | null;
profile_image_url: string | null;
is_new_user: boolean;
}
// 카카오 콜백 응답 (JWT 토큰)
export interface KakaoCallbackResponse {
access_token: string;
refresh_token: string;
token_type: string;
expires_in: number;
user: KakaoCallbackUser;
redirect_url: string;
}
// 토큰 갱신 응답
export interface TokenRefreshResponse {
access_token: string;
token_type: string;
expires_in: number;
}
// 사용자 정보 응답
export interface UserMeResponse {
id: number;
kakao_id: string;
nickname: string;
profile_image: string | null;
created_at: string;
}