@charzing/vehicle-utils 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +130 -0
- package/dist/cjs/index.d.ts +714 -0
- package/dist/cjs/index.js +357 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/esm/index.d.mts +714 -0
- package/dist/esm/index.mjs +313 -0
- package/dist/esm/index.mjs.map +1 -0
- package/dist/index.d.mts +714 -0
- package/dist/index.d.ts +714 -0
- package/dist/index.js +357 -0
- package/dist/index.js.map +1 -0
- package/package.json +49 -0
|
@@ -0,0 +1,714 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 브랜드 관련 타입 정의
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* 브랜드 ID (Firestore 문서 ID)
|
|
6
|
+
* @example 'hyundai', 'kia', 'tesla', 'bmw', 'mini', 'audi', 'mercedes-benz', 'mercedes-maybach', 'porsche'
|
|
7
|
+
*/
|
|
8
|
+
type BrandId = 'hyundai' | 'kia' | 'tesla' | 'bmw' | 'mini' | 'audi' | 'mercedes-benz' | 'mercedes-maybach' | 'porsche';
|
|
9
|
+
/**
|
|
10
|
+
* 브랜드 정보
|
|
11
|
+
*/
|
|
12
|
+
interface Brand {
|
|
13
|
+
/** Firestore 문서 ID (소문자, 하이픈) */
|
|
14
|
+
id: BrandId;
|
|
15
|
+
/** 한글 브랜드명 */
|
|
16
|
+
name: string;
|
|
17
|
+
/** 영문 브랜드명 (대문자) */
|
|
18
|
+
englishName: string;
|
|
19
|
+
/** 브랜드 로고 URL */
|
|
20
|
+
logoUrl?: string;
|
|
21
|
+
/** 모델 수 (선택적) */
|
|
22
|
+
modelsCount?: number;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Firebase Storage 브랜드명 (대문자)
|
|
26
|
+
* Mercedes-Benz와 Mercedes-Maybach는 'BENZ'로 통합
|
|
27
|
+
*/
|
|
28
|
+
type StorageBrandName = 'HYUNDAI' | 'KIA' | 'TESLA' | 'BMW' | 'MINI' | 'AUDI' | 'BENZ' | 'PORSCHE';
|
|
29
|
+
/**
|
|
30
|
+
* 브랜드 매핑 결과
|
|
31
|
+
*/
|
|
32
|
+
interface BrandMapping {
|
|
33
|
+
/** Firestore ID (소문자) */
|
|
34
|
+
firestoreId: BrandId;
|
|
35
|
+
/** 한글 브랜드명 */
|
|
36
|
+
koreanName: string;
|
|
37
|
+
/** 영문 브랜드명 (대문자) */
|
|
38
|
+
englishName: string;
|
|
39
|
+
/** Storage 브랜드명 (대문자) */
|
|
40
|
+
storageName: StorageBrandName;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* 모델 관련 타입 정의
|
|
45
|
+
*/
|
|
46
|
+
/**
|
|
47
|
+
* 모델 ID (Firestore 문서 ID)
|
|
48
|
+
* 소문자, 하이픈으로 구분
|
|
49
|
+
* @example 'ioniq-5', 'model-s', 'cooper', 'i4'
|
|
50
|
+
*/
|
|
51
|
+
type ModelId = string;
|
|
52
|
+
/**
|
|
53
|
+
* 모델 정보
|
|
54
|
+
*/
|
|
55
|
+
interface Model {
|
|
56
|
+
/** Firestore 문서 ID (소문자, 하이픈) */
|
|
57
|
+
id: ModelId;
|
|
58
|
+
/** 한글 모델명 */
|
|
59
|
+
name: string;
|
|
60
|
+
/** 영문 모델명 */
|
|
61
|
+
englishName: string;
|
|
62
|
+
/** 브랜드 ID */
|
|
63
|
+
brandId: string;
|
|
64
|
+
/** 모델 이미지 URL */
|
|
65
|
+
imageUrl?: string;
|
|
66
|
+
/** 트림 수 (선택적) */
|
|
67
|
+
trimsCount?: number;
|
|
68
|
+
/** 생산 시작 연도 */
|
|
69
|
+
startYear?: number;
|
|
70
|
+
/** 생산 종료 연도 */
|
|
71
|
+
endYear?: number;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* 모델 슬러그 (URL/파일명용)
|
|
75
|
+
* 소문자, 하이픈으로 구분
|
|
76
|
+
* @example 'ioniq-5', 'model-s', 'cooper'
|
|
77
|
+
*/
|
|
78
|
+
type ModelSlug = string;
|
|
79
|
+
/**
|
|
80
|
+
* 모델 매핑 결과
|
|
81
|
+
*/
|
|
82
|
+
interface ModelMapping {
|
|
83
|
+
/** Firestore ID (소문자, 하이픈) */
|
|
84
|
+
firestoreId: ModelId;
|
|
85
|
+
/** 한글 모델명 */
|
|
86
|
+
koreanName: string;
|
|
87
|
+
/** 영문 모델명 */
|
|
88
|
+
englishName: string;
|
|
89
|
+
/** URL/파일명용 슬러그 */
|
|
90
|
+
slug: ModelSlug;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* 트림 관련 타입 정의
|
|
95
|
+
*/
|
|
96
|
+
/**
|
|
97
|
+
* 트림 ID (Firestore 내부 ID)
|
|
98
|
+
* 소문자, 하이픈으로 구분
|
|
99
|
+
* @example 'exclusive', 'jcw', 'highland', 'turbo-gt'
|
|
100
|
+
*/
|
|
101
|
+
type TrimId = string;
|
|
102
|
+
/**
|
|
103
|
+
* 구동 방식
|
|
104
|
+
*/
|
|
105
|
+
type DriveType = 'FWD' | 'RWD' | 'AWD' | '4WD';
|
|
106
|
+
/**
|
|
107
|
+
* 차량 변형 (연식별 스펙)
|
|
108
|
+
*/
|
|
109
|
+
interface VehicleVariant {
|
|
110
|
+
/** 해당 연도들 */
|
|
111
|
+
years: number[];
|
|
112
|
+
/** 배터리 용량 (kWh) */
|
|
113
|
+
batteryCapacity: number;
|
|
114
|
+
/** 주행거리 (km) */
|
|
115
|
+
range: number;
|
|
116
|
+
/** 배터리 공급사 */
|
|
117
|
+
supplier?: string;
|
|
118
|
+
/** 배터리 타입 */
|
|
119
|
+
batteryType?: string;
|
|
120
|
+
/** 이미지 URL (트림별 디자인 차이가 있는 경우) */
|
|
121
|
+
imageUrl?: string;
|
|
122
|
+
/** 참고사항 */
|
|
123
|
+
note?: string;
|
|
124
|
+
/** 상세 스펙 */
|
|
125
|
+
specifications?: {
|
|
126
|
+
/** 모터 타입 */
|
|
127
|
+
motor?: string;
|
|
128
|
+
/** 출력 */
|
|
129
|
+
power?: string;
|
|
130
|
+
/** 토크 */
|
|
131
|
+
torque?: string;
|
|
132
|
+
/** 가속 성능 (0-100km/h) */
|
|
133
|
+
acceleration?: string;
|
|
134
|
+
/** 충전 속도 */
|
|
135
|
+
chargingSpeed?: string;
|
|
136
|
+
/** 충전 커넥터 규격 */
|
|
137
|
+
chargingConnector?: string;
|
|
138
|
+
/** 최고속도 */
|
|
139
|
+
topSpeed?: string;
|
|
140
|
+
/** 연비 */
|
|
141
|
+
efficiency?: string;
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* 차량 트림 정보
|
|
146
|
+
*/
|
|
147
|
+
interface VehicleTrim {
|
|
148
|
+
/** 트림 ID */
|
|
149
|
+
trimId: TrimId;
|
|
150
|
+
/** 트림명 */
|
|
151
|
+
name: string;
|
|
152
|
+
/** 구동 방식 */
|
|
153
|
+
driveType: DriveType;
|
|
154
|
+
/** 생산 연도 범위 */
|
|
155
|
+
yearRange: {
|
|
156
|
+
start: number;
|
|
157
|
+
end: number;
|
|
158
|
+
};
|
|
159
|
+
/** 연식별 변형 */
|
|
160
|
+
variants: VehicleVariant[];
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* 트림 슬러그 (URL/파일명용)
|
|
164
|
+
* 소문자, 하이픈으로 구분
|
|
165
|
+
* @example 'exclusive', 'jcw', 'highland'
|
|
166
|
+
*/
|
|
167
|
+
type TrimSlug = string;
|
|
168
|
+
/**
|
|
169
|
+
* 트림 매핑 결과
|
|
170
|
+
*/
|
|
171
|
+
interface TrimMapping {
|
|
172
|
+
/** Firestore ID (소문자, 하이픈) */
|
|
173
|
+
firestoreId: TrimId;
|
|
174
|
+
/** 트림명 */
|
|
175
|
+
name: string;
|
|
176
|
+
/** URL/파일명용 슬러그 */
|
|
177
|
+
slug: TrimSlug;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* 차량 통합 타입 정의
|
|
182
|
+
*/
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* 배터리 정보
|
|
186
|
+
*/
|
|
187
|
+
interface BatteryInfo {
|
|
188
|
+
/** 배터리 용량 (kWh) */
|
|
189
|
+
capacity: number;
|
|
190
|
+
/** 배터리 공급사 */
|
|
191
|
+
supplier: string;
|
|
192
|
+
/** 배터리 타입 (NCM, NCA, LFP 등) */
|
|
193
|
+
type: string;
|
|
194
|
+
/** 전압 (V) */
|
|
195
|
+
voltage: number;
|
|
196
|
+
/** 주행거리 (km) */
|
|
197
|
+
range: number;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* 차량 모델 (Firestore 구조)
|
|
201
|
+
*/
|
|
202
|
+
interface VehicleModel {
|
|
203
|
+
/** 모델 ID */
|
|
204
|
+
id: ModelId;
|
|
205
|
+
/** 한글 모델명 */
|
|
206
|
+
name: string;
|
|
207
|
+
/** 영문 모델명 */
|
|
208
|
+
englishName: string;
|
|
209
|
+
/** 모델 이미지 URL */
|
|
210
|
+
imageUrl?: string;
|
|
211
|
+
/** 기본 배터리 정보 */
|
|
212
|
+
defaultBattery: BatteryInfo;
|
|
213
|
+
/** 트림 목록 */
|
|
214
|
+
trims: VehicleTrim[];
|
|
215
|
+
/** 생성일 */
|
|
216
|
+
createdAt?: Date;
|
|
217
|
+
/** 수정일 */
|
|
218
|
+
updatedAt?: Date;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* 완성된 차량 정보 (사용자 선택 결과)
|
|
222
|
+
*/
|
|
223
|
+
interface CompletedVehicle {
|
|
224
|
+
/** 제조사 (한글) */
|
|
225
|
+
make: string;
|
|
226
|
+
/** 모델명 (한글) */
|
|
227
|
+
model: string;
|
|
228
|
+
/** 트림명 */
|
|
229
|
+
trim: string;
|
|
230
|
+
/** 연식 */
|
|
231
|
+
year: number;
|
|
232
|
+
/** 브랜드 ID (소문자) */
|
|
233
|
+
brandId: BrandId;
|
|
234
|
+
/** 모델 ID (소문자, 하이픈) */
|
|
235
|
+
modelId: ModelId;
|
|
236
|
+
/** 트림 ID (소문자, 하이픈) */
|
|
237
|
+
trimId: TrimId;
|
|
238
|
+
/** 배터리 용량 */
|
|
239
|
+
batteryCapacity?: number | string;
|
|
240
|
+
/** 이미지 URL */
|
|
241
|
+
imageUrl?: string;
|
|
242
|
+
/** 주행거리 */
|
|
243
|
+
range?: number | string;
|
|
244
|
+
/** 구동 방식 */
|
|
245
|
+
driveType?: DriveType;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* 차량 상세 정보
|
|
249
|
+
*/
|
|
250
|
+
interface VehicleDetails {
|
|
251
|
+
/** 모델명 */
|
|
252
|
+
modelName: string;
|
|
253
|
+
/** 이미지 URL */
|
|
254
|
+
imageUrl: string;
|
|
255
|
+
/** 배터리 정보 */
|
|
256
|
+
battery: {
|
|
257
|
+
capacity: number;
|
|
258
|
+
manufacturer: string;
|
|
259
|
+
cellType: string;
|
|
260
|
+
voltage: number;
|
|
261
|
+
};
|
|
262
|
+
/** 성능 정보 */
|
|
263
|
+
performance: {
|
|
264
|
+
range: number;
|
|
265
|
+
topSpeed: number;
|
|
266
|
+
power: number;
|
|
267
|
+
torque: number;
|
|
268
|
+
efficiency: number;
|
|
269
|
+
acceleration: number;
|
|
270
|
+
driveType: string;
|
|
271
|
+
chargingSpeed?: string;
|
|
272
|
+
chargingConnector?: string;
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* 사용자 차량 (앱에서 사용)
|
|
277
|
+
*/
|
|
278
|
+
interface UserVehicle {
|
|
279
|
+
/** 차량 ID */
|
|
280
|
+
id: string;
|
|
281
|
+
/** 사용자 ID */
|
|
282
|
+
userId: string;
|
|
283
|
+
/** 제조사 */
|
|
284
|
+
make: string;
|
|
285
|
+
/** 모델명 */
|
|
286
|
+
model: string;
|
|
287
|
+
/** 연식 */
|
|
288
|
+
year: number;
|
|
289
|
+
/** 트림 */
|
|
290
|
+
trim?: string;
|
|
291
|
+
/** 배터리 용량 */
|
|
292
|
+
batteryCapacity?: string;
|
|
293
|
+
/** 주행거리 */
|
|
294
|
+
range?: string;
|
|
295
|
+
/** 차량 별명 */
|
|
296
|
+
nickname?: string;
|
|
297
|
+
/** 이미지 URL */
|
|
298
|
+
imageUrl?: string;
|
|
299
|
+
/** 활성 상태 */
|
|
300
|
+
isActive: boolean;
|
|
301
|
+
/** 생성일 */
|
|
302
|
+
createdAt: Date;
|
|
303
|
+
/** 수정일 */
|
|
304
|
+
updatedAt: Date;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* 이미지 관련 타입 정의
|
|
309
|
+
*/
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* Firebase Storage 설정
|
|
313
|
+
*/
|
|
314
|
+
interface FirebaseStorageConfig {
|
|
315
|
+
/** Storage 버킷명 */
|
|
316
|
+
bucket: string;
|
|
317
|
+
/** 베이스 경로 */
|
|
318
|
+
basePath: string;
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* 차량 이미지 파라미터
|
|
322
|
+
*/
|
|
323
|
+
interface VehicleImageParams {
|
|
324
|
+
/** 브랜드 ID (소문자) */
|
|
325
|
+
brand: BrandId | string;
|
|
326
|
+
/** 모델 슬러그 (소문자, 하이픈) */
|
|
327
|
+
model: ModelSlug | string;
|
|
328
|
+
/** 연식 */
|
|
329
|
+
year: number;
|
|
330
|
+
/** 트림 슬러그 (선택적, 소문자, 하이픈) */
|
|
331
|
+
trim?: TrimSlug | string;
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* 이미지 URL 생성 옵션
|
|
335
|
+
*/
|
|
336
|
+
interface ImageUrlOptions {
|
|
337
|
+
/** Firebase Storage 버킷명 */
|
|
338
|
+
bucket?: string;
|
|
339
|
+
/** 파일 확장자 */
|
|
340
|
+
extension?: 'png' | 'jpg' | 'webp';
|
|
341
|
+
/** Fallback 이미지 사용 여부 */
|
|
342
|
+
useFallback?: boolean;
|
|
343
|
+
}
|
|
344
|
+
/**
|
|
345
|
+
* 이미지 파일명 형식
|
|
346
|
+
* @example 'hyundai__ioniq-5__2024.png', 'mini__cooper__2025__jcw.png'
|
|
347
|
+
*/
|
|
348
|
+
type ImageFilename = `${string}__${string}__${number}${`__${string}` | ''}.${string}`;
|
|
349
|
+
/**
|
|
350
|
+
* 이미지 경로 정보
|
|
351
|
+
*/
|
|
352
|
+
interface ImagePath {
|
|
353
|
+
/** Firebase Storage 전체 경로 */
|
|
354
|
+
fullPath: string;
|
|
355
|
+
/** 디렉토리 경로 */
|
|
356
|
+
directory: string;
|
|
357
|
+
/** 파일명 */
|
|
358
|
+
filename: ImageFilename;
|
|
359
|
+
/** 다운로드 URL */
|
|
360
|
+
downloadUrl: string;
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* 이미지 Fallback 전략
|
|
364
|
+
*/
|
|
365
|
+
type ImageFallbackStrategy = 'trim' | 'standard' | 'base' | 'brand';
|
|
366
|
+
/**
|
|
367
|
+
* 이미지 Fallback 옵션
|
|
368
|
+
*/
|
|
369
|
+
interface ImageFallbackOptions {
|
|
370
|
+
/** Fallback 전략 배열 */
|
|
371
|
+
strategies: ImageFallbackStrategy[];
|
|
372
|
+
/** 기본 이미지 URL */
|
|
373
|
+
defaultImageUrl?: string;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
/**
|
|
377
|
+
* 브랜드 매핑 유틸리티
|
|
378
|
+
*
|
|
379
|
+
* 한글/영문 브랜드명 변환, Firestore ID 정규화, Storage 브랜드명 매핑
|
|
380
|
+
*/
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* 브랜드 ID 정규화 (소문자 통일)
|
|
384
|
+
*
|
|
385
|
+
* @param brandInput - 브랜드명 (한글, 영문, 대소문자 무관)
|
|
386
|
+
* @returns Firestore 브랜드 ID (소문자, 하이픈)
|
|
387
|
+
*
|
|
388
|
+
* @example
|
|
389
|
+
* ```typescript
|
|
390
|
+
* normalizeBrandId('현대'); // 'hyundai'
|
|
391
|
+
* normalizeBrandId('BMW'); // 'bmw'
|
|
392
|
+
* normalizeBrandId('Mercedes-Benz'); // 'mercedes-benz'
|
|
393
|
+
* ```
|
|
394
|
+
*/
|
|
395
|
+
declare function normalizeBrandId(brandInput: string): BrandId;
|
|
396
|
+
/**
|
|
397
|
+
* 한글 브랜드명 가져오기
|
|
398
|
+
*
|
|
399
|
+
* @param brandId - Firestore 브랜드 ID
|
|
400
|
+
* @returns 한글 브랜드명
|
|
401
|
+
*
|
|
402
|
+
* @example
|
|
403
|
+
* ```typescript
|
|
404
|
+
* getBrandNameKorean('hyundai'); // '현대'
|
|
405
|
+
* getBrandNameKorean('bmw'); // 'BMW'
|
|
406
|
+
* ```
|
|
407
|
+
*/
|
|
408
|
+
declare function getBrandNameKorean(brandId: BrandId): string;
|
|
409
|
+
/**
|
|
410
|
+
* 영문 브랜드명 가져오기
|
|
411
|
+
*
|
|
412
|
+
* @param brandId - Firestore 브랜드 ID
|
|
413
|
+
* @returns 영문 브랜드명
|
|
414
|
+
*
|
|
415
|
+
* @example
|
|
416
|
+
* ```typescript
|
|
417
|
+
* getBrandNameEnglish('hyundai'); // 'HYUNDAI'
|
|
418
|
+
* getBrandNameEnglish('mercedes-benz'); // 'Mercedes-Benz'
|
|
419
|
+
* ```
|
|
420
|
+
*/
|
|
421
|
+
declare function getBrandNameEnglish(brandId: BrandId): string;
|
|
422
|
+
/**
|
|
423
|
+
* Firebase Storage 브랜드명 가져오기
|
|
424
|
+
*
|
|
425
|
+
* @param brandId - Firestore 브랜드 ID
|
|
426
|
+
* @returns Storage 브랜드명 (대문자)
|
|
427
|
+
*
|
|
428
|
+
* @example
|
|
429
|
+
* ```typescript
|
|
430
|
+
* getStorageBrandName('hyundai'); // 'HYUNDAI'
|
|
431
|
+
* getStorageBrandName('mercedes-benz'); // 'BENZ'
|
|
432
|
+
* getStorageBrandName('mercedes-maybach'); // 'BENZ'
|
|
433
|
+
* ```
|
|
434
|
+
*/
|
|
435
|
+
declare function getStorageBrandName(brandId: BrandId): StorageBrandName;
|
|
436
|
+
/**
|
|
437
|
+
* 브랜드 매핑 정보 가져오기 (통합 함수)
|
|
438
|
+
*
|
|
439
|
+
* @param brandInput - 브랜드명 (한글, 영문, 대소문자 무관)
|
|
440
|
+
* @returns 브랜드 매핑 정보
|
|
441
|
+
*
|
|
442
|
+
* @example
|
|
443
|
+
* ```typescript
|
|
444
|
+
* getBrandMapping('현대');
|
|
445
|
+
* // {
|
|
446
|
+
* // firestoreId: 'hyundai',
|
|
447
|
+
* // koreanName: '현대',
|
|
448
|
+
* // englishName: 'HYUNDAI',
|
|
449
|
+
* // storageName: 'HYUNDAI'
|
|
450
|
+
* // }
|
|
451
|
+
* ```
|
|
452
|
+
*/
|
|
453
|
+
declare function getBrandMapping(brandInput: string): BrandMapping;
|
|
454
|
+
/**
|
|
455
|
+
* 지원되는 모든 브랜드 ID 목록
|
|
456
|
+
*/
|
|
457
|
+
declare const SUPPORTED_BRANDS: BrandId[];
|
|
458
|
+
|
|
459
|
+
/**
|
|
460
|
+
* 모델 매핑 유틸리티
|
|
461
|
+
*
|
|
462
|
+
* 한글/영문 모델명 변환, 모델 ID 정규화, 유사도 기반 매칭
|
|
463
|
+
*/
|
|
464
|
+
|
|
465
|
+
/**
|
|
466
|
+
* 문자열을 슬러그로 변환
|
|
467
|
+
* - 소문자 변환
|
|
468
|
+
* - 공백/언더바 → 하이픈
|
|
469
|
+
* - 연속 하이픈 제거
|
|
470
|
+
* - 앞뒤 하이픈 제거
|
|
471
|
+
*
|
|
472
|
+
* @param str - 변환할 문자열
|
|
473
|
+
* @returns 슬러그 문자열
|
|
474
|
+
*
|
|
475
|
+
* @example
|
|
476
|
+
* ```typescript
|
|
477
|
+
* toSlug('IONIQ 5'); // 'ioniq-5'
|
|
478
|
+
* toSlug('Model S'); // 'model-s'
|
|
479
|
+
* toSlug('Cooper JCW'); // 'cooper-jcw'
|
|
480
|
+
* ```
|
|
481
|
+
*/
|
|
482
|
+
declare function toSlug(str: string): string;
|
|
483
|
+
/**
|
|
484
|
+
* 한글 모델명을 영문으로 변환
|
|
485
|
+
*
|
|
486
|
+
* @param koreanModel - 한글 모델명
|
|
487
|
+
* @returns 영문 모델명
|
|
488
|
+
*
|
|
489
|
+
* @example
|
|
490
|
+
* ```typescript
|
|
491
|
+
* convertKoreanToEnglish('아이오닉 5'); // 'IONIQ 5'
|
|
492
|
+
* convertKoreanToEnglish('니로 EV'); // 'NIRO EV'
|
|
493
|
+
* convertKoreanToEnglish('쿠퍼'); // 'COOPER'
|
|
494
|
+
* ```
|
|
495
|
+
*/
|
|
496
|
+
declare function convertKoreanToEnglish(koreanModel: string): string;
|
|
497
|
+
/**
|
|
498
|
+
* 모델 ID 정규화 (소문자, 하이픈)
|
|
499
|
+
*
|
|
500
|
+
* @param modelInput - 모델명 (한글, 영문, 대소문자 무관)
|
|
501
|
+
* @returns Firestore 모델 ID (소문자, 하이픈)
|
|
502
|
+
*
|
|
503
|
+
* @example
|
|
504
|
+
* ```typescript
|
|
505
|
+
* normalizeModelId('아이오닉 5'); // 'ioniq-5'
|
|
506
|
+
* normalizeModelId('Model S'); // 'model-s'
|
|
507
|
+
* normalizeModelId('COOPER JCW'); // 'cooper-jcw'
|
|
508
|
+
* ```
|
|
509
|
+
*/
|
|
510
|
+
declare function normalizeModelId(modelInput: string): ModelId;
|
|
511
|
+
/**
|
|
512
|
+
* 가능한 모델 목록에서 최적 매칭 찾기
|
|
513
|
+
* - 정확한 매칭 우선
|
|
514
|
+
* - 없으면 유사도 점수 기반 매칭
|
|
515
|
+
*
|
|
516
|
+
* @param inputModel - 입력 모델명
|
|
517
|
+
* @param availableModels - 가능한 모델 ID 목록
|
|
518
|
+
* @returns 매칭된 모델 ID 또는 null
|
|
519
|
+
*
|
|
520
|
+
* @example
|
|
521
|
+
* ```typescript
|
|
522
|
+
* findBestModelMatch('아이오닉5', ['ioniq-5', 'ioniq-6', 'kona-electric']);
|
|
523
|
+
* // 'ioniq-5'
|
|
524
|
+
*
|
|
525
|
+
* findBestModelMatch('NEXSO', ['ioniq-5', 'nexo', 'kona-electric']);
|
|
526
|
+
* // 'nexo' (유사도 매칭)
|
|
527
|
+
* ```
|
|
528
|
+
*/
|
|
529
|
+
declare function findBestModelMatch(inputModel: string, availableModels: string[]): string | null;
|
|
530
|
+
/**
|
|
531
|
+
* 모델 슬러그 생성 (URL/파일명용)
|
|
532
|
+
*
|
|
533
|
+
* @param modelInput - 모델명
|
|
534
|
+
* @returns 모델 슬러그
|
|
535
|
+
*
|
|
536
|
+
* @example
|
|
537
|
+
* ```typescript
|
|
538
|
+
* getModelSlug('아이오닉 5'); // 'ioniq-5'
|
|
539
|
+
* getModelSlug('Model 3'); // 'model-3'
|
|
540
|
+
* ```
|
|
541
|
+
*/
|
|
542
|
+
declare function getModelSlug(modelInput: string): ModelSlug;
|
|
543
|
+
/**
|
|
544
|
+
* 모델 매핑 정보 가져오기
|
|
545
|
+
*
|
|
546
|
+
* @param modelInput - 모델명 (한글 또는 영문)
|
|
547
|
+
* @param englishName - 영문 모델명 (선택적)
|
|
548
|
+
* @param koreanName - 한글 모델명 (선택적)
|
|
549
|
+
* @returns 모델 매핑 정보
|
|
550
|
+
*
|
|
551
|
+
* @example
|
|
552
|
+
* ```typescript
|
|
553
|
+
* getModelMapping('아이오닉 5', 'IONIQ-5', '아이오닉 5');
|
|
554
|
+
* // {
|
|
555
|
+
* // firestoreId: 'ioniq-5',
|
|
556
|
+
* // koreanName: '아이오닉 5',
|
|
557
|
+
* // englishName: 'IONIQ-5',
|
|
558
|
+
* // slug: 'ioniq-5'
|
|
559
|
+
* // }
|
|
560
|
+
* ```
|
|
561
|
+
*/
|
|
562
|
+
declare function getModelMapping(modelInput: string, englishName?: string, koreanName?: string): ModelMapping;
|
|
563
|
+
|
|
564
|
+
/**
|
|
565
|
+
* 이미지 파일명 생성 유틸리티
|
|
566
|
+
*
|
|
567
|
+
* 표준 파일명 규칙: {brandSlug}__{modelSlug}__{year}__{trimSlug}.png
|
|
568
|
+
*/
|
|
569
|
+
|
|
570
|
+
/**
|
|
571
|
+
* 차량 이미지 파일명 생성
|
|
572
|
+
*
|
|
573
|
+
* @param params - 차량 이미지 파라미터
|
|
574
|
+
* @param extension - 파일 확장자 (기본: 'png')
|
|
575
|
+
* @returns 이미지 파일명
|
|
576
|
+
*
|
|
577
|
+
* @example
|
|
578
|
+
* ```typescript
|
|
579
|
+
* generateImageFilename({
|
|
580
|
+
* brand: 'hyundai',
|
|
581
|
+
* model: 'ioniq-5',
|
|
582
|
+
* year: 2024
|
|
583
|
+
* });
|
|
584
|
+
* // 'hyundai__ioniq-5__2024.png'
|
|
585
|
+
*
|
|
586
|
+
* generateImageFilename({
|
|
587
|
+
* brand: 'mini',
|
|
588
|
+
* model: 'cooper',
|
|
589
|
+
* year: 2025,
|
|
590
|
+
* trim: 'jcw'
|
|
591
|
+
* });
|
|
592
|
+
* // 'mini__cooper__2025__jcw.png'
|
|
593
|
+
*
|
|
594
|
+
* generateImageFilename({
|
|
595
|
+
* brand: 'Tesla',
|
|
596
|
+
* model: 'Model 3',
|
|
597
|
+
* year: 2024,
|
|
598
|
+
* trim: 'Highland'
|
|
599
|
+
* }, 'webp');
|
|
600
|
+
* // 'tesla__model-3__2024__highland.webp'
|
|
601
|
+
* ```
|
|
602
|
+
*/
|
|
603
|
+
declare function generateImageFilename(params: VehicleImageParams, extension?: 'png' | 'jpg' | 'webp'): ImageFilename;
|
|
604
|
+
/**
|
|
605
|
+
* 파일명에서 차량 정보 추출
|
|
606
|
+
*
|
|
607
|
+
* @param filename - 이미지 파일명
|
|
608
|
+
* @returns 차량 정보 또는 null
|
|
609
|
+
*
|
|
610
|
+
* @example
|
|
611
|
+
* ```typescript
|
|
612
|
+
* parseImageFilename('hyundai__ioniq-5__2024.png');
|
|
613
|
+
* // { brand: 'hyundai', model: 'ioniq-5', year: 2024 }
|
|
614
|
+
*
|
|
615
|
+
* parseImageFilename('mini__cooper__2025__jcw.png');
|
|
616
|
+
* // { brand: 'mini', model: 'cooper', year: 2025, trim: 'jcw' }
|
|
617
|
+
* ```
|
|
618
|
+
*/
|
|
619
|
+
declare function parseImageFilename(filename: string): VehicleImageParams | null;
|
|
620
|
+
/**
|
|
621
|
+
* 파일명 검증
|
|
622
|
+
*
|
|
623
|
+
* @param filename - 검증할 파일명
|
|
624
|
+
* @returns 유효 여부
|
|
625
|
+
*
|
|
626
|
+
* @example
|
|
627
|
+
* ```typescript
|
|
628
|
+
* isValidImageFilename('hyundai__ioniq-5__2024.png'); // true
|
|
629
|
+
* isValidImageFilename('invalid-filename.png'); // false
|
|
630
|
+
* ```
|
|
631
|
+
*/
|
|
632
|
+
declare function isValidImageFilename(filename: string): boolean;
|
|
633
|
+
|
|
634
|
+
/**
|
|
635
|
+
* 이미지 URL 생성 유틸리티
|
|
636
|
+
*
|
|
637
|
+
* Firebase Storage URL 생성 및 Fallback 처리
|
|
638
|
+
*/
|
|
639
|
+
|
|
640
|
+
/**
|
|
641
|
+
* 차량 이미지 URL 생성
|
|
642
|
+
*
|
|
643
|
+
* @param params - 차량 이미지 파라미터
|
|
644
|
+
* @param options - URL 생성 옵션
|
|
645
|
+
* @returns 이미지 다운로드 URL
|
|
646
|
+
*
|
|
647
|
+
* @example
|
|
648
|
+
* ```typescript
|
|
649
|
+
* generateVehicleImageUrl({
|
|
650
|
+
* brand: 'hyundai',
|
|
651
|
+
* model: 'ioniq-5',
|
|
652
|
+
* year: 2024
|
|
653
|
+
* });
|
|
654
|
+
* // 'https://firebasestorage.googleapis.com/v0/b/charzing-d1600.firebasestorage.app/o/
|
|
655
|
+
* // vehicle-images%2FHYUNDAI%2FIONIQ-5%2F2024%2Fhyundai__ioniq-5__2024.png?alt=media'
|
|
656
|
+
*
|
|
657
|
+
* generateVehicleImageUrl({
|
|
658
|
+
* brand: 'mini',
|
|
659
|
+
* model: 'cooper',
|
|
660
|
+
* year: 2025,
|
|
661
|
+
* trim: 'jcw'
|
|
662
|
+
* });
|
|
663
|
+
* // 'https://firebasestorage.googleapis.com/v0/b/charzing-d1600.firebasestorage.app/o/
|
|
664
|
+
* // vehicle-images%2FMINI%2FCOOPER%2F2025%2Fmini__cooper__2025__jcw.png?alt=media'
|
|
665
|
+
* ```
|
|
666
|
+
*/
|
|
667
|
+
declare function generateVehicleImageUrl(params: VehicleImageParams, options?: ImageUrlOptions): string;
|
|
668
|
+
/**
|
|
669
|
+
* 차량 이미지 경로 정보 가져오기
|
|
670
|
+
*
|
|
671
|
+
* @param params - 차량 이미지 파라미터
|
|
672
|
+
* @param options - URL 생성 옵션
|
|
673
|
+
* @returns 이미지 경로 정보
|
|
674
|
+
*
|
|
675
|
+
* @example
|
|
676
|
+
* ```typescript
|
|
677
|
+
* getVehicleImagePath({
|
|
678
|
+
* brand: 'hyundai',
|
|
679
|
+
* model: 'ioniq-5',
|
|
680
|
+
* year: 2024
|
|
681
|
+
* });
|
|
682
|
+
* // {
|
|
683
|
+
* // fullPath: 'vehicle-images/HYUNDAI/IONIQ-5/2024/hyundai__ioniq-5__2024.png',
|
|
684
|
+
* // directory: 'vehicle-images/HYUNDAI/IONIQ-5/2024',
|
|
685
|
+
* // filename: 'hyundai__ioniq-5__2024.png',
|
|
686
|
+
* // downloadUrl: 'https://...'
|
|
687
|
+
* // }
|
|
688
|
+
* ```
|
|
689
|
+
*/
|
|
690
|
+
declare function getVehicleImagePath(params: VehicleImageParams, options?: ImageUrlOptions): ImagePath;
|
|
691
|
+
/**
|
|
692
|
+
* Fallback 이미지 URL 목록 생성
|
|
693
|
+
*
|
|
694
|
+
* @param params - 차량 이미지 파라미터
|
|
695
|
+
* @param options - URL 생성 옵션
|
|
696
|
+
* @returns Fallback URL 목록 (우선순위 순)
|
|
697
|
+
*
|
|
698
|
+
* @example
|
|
699
|
+
* ```typescript
|
|
700
|
+
* generateFallbackUrls({
|
|
701
|
+
* brand: 'mini',
|
|
702
|
+
* model: 'cooper',
|
|
703
|
+
* year: 2025,
|
|
704
|
+
* trim: 'jcw'
|
|
705
|
+
* });
|
|
706
|
+
* // [
|
|
707
|
+
* // 'https://.../mini__cooper__2025__jcw.png', // 트림 이미지
|
|
708
|
+
* // 'https://.../mini__cooper__2025.png', // 기본 모델 이미지
|
|
709
|
+
* // ]
|
|
710
|
+
* ```
|
|
711
|
+
*/
|
|
712
|
+
declare function generateFallbackUrls(params: VehicleImageParams, options?: ImageUrlOptions): string[];
|
|
713
|
+
|
|
714
|
+
export { type BatteryInfo, type Brand, type BrandId, type BrandMapping, type CompletedVehicle, type DriveType, type FirebaseStorageConfig, type ImageFallbackOptions, type ImageFallbackStrategy, type ImageFilename, type ImagePath, type ImageUrlOptions, type Model, type ModelId, type ModelMapping, type ModelSlug, SUPPORTED_BRANDS, type StorageBrandName, type TrimId, type TrimMapping, type TrimSlug, type UserVehicle, type VehicleDetails, type VehicleImageParams, type VehicleModel, type VehicleTrim, type VehicleVariant, convertKoreanToEnglish, findBestModelMatch, generateFallbackUrls, generateImageFilename, generateVehicleImageUrl, getBrandMapping, getBrandNameEnglish, getBrandNameKorean, getModelMapping, getModelSlug, getStorageBrandName, getVehicleImagePath, isValidImageFilename, normalizeBrandId, normalizeModelId, parseImageFilename, toSlug };
|