-- | Definition of types

module Database.ClickHouseDriver.HTTP.Types
  ( JSONResult (..),
    Cmd,
    Haxl,
    Format(..),
    HttpConnection(..),
    HttpParams(..)
  )
where

import           Data.Aeson           (Value)
import           Data.ByteString      (ByteString)
import           Data.HashMap.Strict  (HashMap)
import           Data.Text            (Text)
import           Haxl.Core            (GenHaxl)           
import           Network.HTTP.Client ( Manager )        


type JSONResult = Either ByteString [HashMap Text Value]

type Cmd = String

type Haxl a = GenHaxl () a

data Format = CSV | JSON | TUPLE
    deriving Format -> Format -> Bool
(Format -> Format -> Bool)
-> (Format -> Format -> Bool) -> Eq Format
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Format -> Format -> Bool
$c/= :: Format -> Format -> Bool
== :: Format -> Format -> Bool
$c== :: Format -> Format -> Bool
Eq

data HttpParams 
  = HttpParams
      {
        HttpParams -> String
httpHost :: !String,
        HttpParams -> Int
httpPort :: {-# UNPACK #-}  !Int,
        HttpParams -> String
httpUsername :: !String,
        HttpParams -> String
httpPassword :: !String,
        HttpParams -> Maybe String
httpDatabase :: Maybe String
      }

data HttpConnection
  = HttpConnection
      { HttpConnection -> HttpParams
httpParams :: !HttpParams,
        -- ^ basic parameters
        HttpConnection -> Manager
httpManager ::  !Manager
        -- ^ http manager 
      }