import {
  IMetadataComponents,
  IMetadataSchema,
  ValidationPipe,
} from "@typia/interface";
import { IJsDocTagInfo } from "typia";

import { IReflectImport } from "./IReflectImport";
import { IReflectType } from "./IReflectType";

export interface IOperationMetadata {
  parameters: IOperationMetadata.IParameter[];
  success: IOperationMetadata.IResponse;
  exceptions: IOperationMetadata.IResponse[];
  description: string | null;
  jsDocTags: IJsDocTagInfo[];
}
export namespace IOperationMetadata {
  export interface IParameter extends IResponse {
    name: string;
    index: number;
    description: string | null;
    jsDocTags: IJsDocTagInfo[];
  }
  export interface IResponse {
    type: IReflectType | null;
    imports: IReflectImport[];
    primitive: ValidationPipe<ISchema, IError>;
    resolved: ValidationPipe<ISchema, IError>;
  }

  export interface ISchema {
    components: IMetadataComponents;
    metadata: IMetadataSchema;
  }
  export interface IError {
    name: string;
    accessor: string | null;
    messages: string[];
  }
}
