{-# LANGUAGE TypeFamilies, DeriveGeneric, TypeApplications, OverloadedStrings #-}
{-# OPTIONS_GHC -fno-warn-unused-imports -fno-warn-name-shadowing -fno-warn-unused-matches #-}

module Agent.Server where

import  Agent.Types
import qualified Pinch.Server
import qualified Jaeger.Types
import qualified Zipkincore.Types
import qualified Prelude
import qualified Control.Applicative
import qualified Control.Exception
import qualified Pinch
import qualified Pinch.Server
import qualified Pinch.Internal.RPC
import qualified Data.Text
import qualified Data.ByteString
import qualified Data.Int
import qualified Data.Vector
import qualified Data.HashMap.Strict
import qualified Data.HashSet
import qualified GHC.Generics
import qualified Data.Hashable
import  Data.Vector.Instances ()

data Agent
  = Agent { Agent -> Context -> Vector Span -> IO ()
emitZipkinBatch :: (Pinch.Server.Context) -> ((Data.Vector.Vector Zipkincore.Types.Span)) -> (Prelude.IO ()), Agent -> Context -> Batch -> IO ()
emitBatch :: (Pinch.Server.Context) -> (Jaeger.Types.Batch) -> (Prelude.IO ()) }


agent_mkServer :: (Agent) -> Pinch.Server.ThriftServer
agent_mkServer :: Agent -> ThriftServer
agent_mkServer Agent
server = let functions :: HashMap Text Handler
functions =   [(Text, Handler)] -> HashMap Text Handler
forall k v. (Eq k, Hashable k) => [(k, v)] -> HashMap k v
Data.HashMap.Strict.fromList ([ ( Text
"emitZipkinBatch"
                                            , (Context -> EmitZipkinBatch_Args -> IO ()) -> Handler
forall c.
(Pinchable c, Tag c ~ TStruct) =>
(Context -> c -> IO ()) -> Handler
Pinch.Server.OnewayHandler ((\Context
ctx (EmitZipkinBatch_Args Vector Span
a) -> Agent -> Context -> Vector Span -> IO ()
emitZipkinBatch (Agent
server) (Context
ctx) (Vector Span
a))) ), ( Text
"emitBatch"
                                            , (Context -> EmitBatch_Args -> IO ()) -> Handler
forall c.
(Pinchable c, Tag c ~ TStruct) =>
(Context -> c -> IO ()) -> Handler
Pinch.Server.OnewayHandler ((\Context
ctx (EmitBatch_Args Batch
a) -> Agent -> Context -> Batch -> IO ()
emitBatch (Agent
server) (Context
ctx) (Batch
a))) ) ]) in (Text -> Maybe Handler) -> ThriftServer
Pinch.Server.createServer ((\Text
nm -> Text -> HashMap Text Handler -> Maybe Handler
forall k v. (Eq k, Hashable k) => k -> HashMap k v -> Maybe v
Data.HashMap.Strict.lookup (Text
nm) (HashMap Text Handler
functions)))