type PrimitiveType = 'string' | 'number' | 'boolean' | 'image' | 'date' | 'UUID'; type ObjectType = { [key: string]: DataType; }; type DataType = PrimitiveType | DataType[] | ObjectType; type Schema = Record; type InferType = T extends 'string' ? string : T extends 'number' ? number : T extends 'boolean' ? boolean : T extends 'image' ? 'image' : T extends 'date' ? Date : T extends 'UUID' ? 'UUID' : T extends DataType[] ? InferType[] : T extends ObjectType ? { [K in keyof T]: InferType; } : never; export type SchemaToType = { [K in keyof S]: InferType; }; type Range = { min: number; max: number; }; type TypeOptions = { string: Range; number: Range; image: { width: Range; height: Range; }; date: { start: DateFormat; end: DateFormat; }; }; interface Options { count: number; type: Partial; } interface UseMockDataProps { options?: Partial; schema: S; } interface UseMockDataReturns { mockData: T; addItem: () => void; } /** * 주어진 스키마와 옵션을 바탕으로 모의 데이터를 생성하는 커스텀 훅. * * @param {Object} params - 훅에 전달되는 파라미터. * @param {S} params.schema - 모의 데이터의 구조를 정의하는 스키마 객체. * @param {Partial} [params.options] - 모의 데이터 생성을 위한 옵션 객체. 기본 값은 `defaultOptions`로 설정됨. * * @template S - 스키마 타입. * * @returns {Object} * - `mockData`: 생성된 모의 데이터 배열. * - `addItem`: 새로운 모의 데이터를 추가하는 함수. 호출 시 현재의 `schema`에 기반한 새로운 데이터를 배열에 추가. * * @description * - 이 훅은 주어진 `schema`와 `options`를 사용하여 모의 데이터를 생성하고 상태로 관리합니다. */ declare const useMockData: ({ schema, options, }: UseMockDataProps) => UseMockDataReturns[]>; type DateFormat = `${string}-${string}-${string}`; export default useMockData; export type { Schema as useMockDataSchema, Options as useMockDataOptions };