import ApiResource from '~/models/ApiResource'
import type { EnumChoice } from '~/types/interfaces'

type AnyJson = Record<string, any>

interface AssociativeArray {
  [key: string]: any
}

interface Connector {
  request(
    method: HTTP_METHOD,
    url: string,
    body: null | any,
    params: null | AssociativeArray,
    query: null | AssociativeArray
  )
}

interface HydraMetadata {
  readonly totalItems?: number
  firstPage?: number
  lastPage?: number
  nextPage?: number
  previousPage?: number
  type?: METADATA_TYPE
}

interface ApiResponse {
  data: AnyJson
  metadata: HydraMetadata
}

interface ApiCollection extends ApiResponse {
  data: AnyJson
  metadata: HydraMetadata
}

interface Pagination {
  first?: number
  last?: number
  next?: number
  previous?: number
}

interface Collection {
  items: Array<ApiResource>
  pagination: Pagination
  totalItems: number | undefined
}

interface EnumItem {
  value: string
  label: string
}

type Enum = Array<EnumChoice>
