export interface IErrorResponse {
  details?: Record<
    string,
    {
      message?: string;
    }
  >;
  fields?: {
    field: string;
    message: string;
  }[];
  message: string;
}
export type SuccessResponseParameter = object | undefined;
export type ErrorResponseParameter = string | undefined;
export type SuccessResponse<T extends SuccessResponseParameter = undefined> = T;
export type ControllerResponse<
  T extends SuccessResponseParameter = SuccessResponseParameter,
> = IErrorResponse | SuccessResponse<T>;

// eslint-disable-next-line @typescript-eslint/no-explicit-any
export type RequestBody = FormData | Record<string, any>;

export interface IResponseToken {
  authToken: string;
}
export type RequestResponse<
  T extends SuccessResponseParameter = SuccessResponseParameter,
> = Promise<
  | {
    isResponseOk: false;
    response: IErrorResponse;
    responseStatus: number | null;
  }
  | {
    isResponseOk: true;
    response: SuccessResponse<T>;
    responseStatus: number | null;
  }
>;