import type { Ref } from 'vue'; import type { ApiParams, CustomerErrorCode, CustomerMFAErrorCode } from '..'; export type ApiStatus = 'pending' | 'success' | 'error'; export type ApiMethod = | 'POST' | 'GET' | 'PUT' | 'PATCH' | 'DELETE' | 'post' | 'get' | 'put' | 'patch' | 'delete'; export interface ApiResponse { data: Ref; status: Ref; error: Ref; fetchData: () => Promise; } export interface ApiContext< RequestType, FieldOptions = '', OrderOptions = FieldOptions, ConditionOptions = FieldOptions, > { endpoint: string; method?: ApiMethod; payload?: RequestType; params?: ApiParams; } export interface ApiError { message: string; errorCode: ApiErrorData['errorCode']; status: number; } export interface ApiErrorData { code: number; datails: []; errorCode: | 'BAD_REQUEST' | 'UNAUTHORIZED' | 'PAYMENT_REQUIRED' | 'FORBIDDEN' | 'NOT_FOUND' | 'METHOD_NOT_ALLOWED Método não permitido' | 'NOT_ACCEPTABLE' | 'PROXY_AUTHENTICATION_REQUIRED' | 'REQUEST_TIME_OUT' | 'CONFLICT' | 'UNSUPPORTED_MIDIA_TYPE' | 'INTERNAL_SERVER_ERROR' | 'NOT_IMPLEMENTED' | 'BAD_GATEWAY' | 'SERVICE_UNAVAILABLE' | 'GATEWAY_TIME_OUT' | 'UAPPI_TOOLS_ITEM_EVALUATED' | 'UAPPI_TOOLS_REVIEW_NOT_FOUND' | CustomerErrorCode | CustomerMFAErrorCode; message: string; }