module Hasura.GraphQL.Execute.Types
  ( GraphQLQueryType (..),
  )
where

import Data.Aeson qualified as J
import Hasura.Prelude

-- graphql-engine supports two GraphQL interfaces: one at v1/graphql, and a Relay one at v1beta1/relay
data GraphQLQueryType
  = QueryHasura
  | QueryRelay
  deriving (Int -> GraphQLQueryType -> ShowS
[GraphQLQueryType] -> ShowS
GraphQLQueryType -> String
(Int -> GraphQLQueryType -> ShowS)
-> (GraphQLQueryType -> String)
-> ([GraphQLQueryType] -> ShowS)
-> Show GraphQLQueryType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GraphQLQueryType -> ShowS
showsPrec :: Int -> GraphQLQueryType -> ShowS
$cshow :: GraphQLQueryType -> String
show :: GraphQLQueryType -> String
$cshowList :: [GraphQLQueryType] -> ShowS
showList :: [GraphQLQueryType] -> ShowS
Show, GraphQLQueryType -> GraphQLQueryType -> Bool
(GraphQLQueryType -> GraphQLQueryType -> Bool)
-> (GraphQLQueryType -> GraphQLQueryType -> Bool)
-> Eq GraphQLQueryType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GraphQLQueryType -> GraphQLQueryType -> Bool
== :: GraphQLQueryType -> GraphQLQueryType -> Bool
$c/= :: GraphQLQueryType -> GraphQLQueryType -> Bool
/= :: GraphQLQueryType -> GraphQLQueryType -> Bool
Eq, Eq GraphQLQueryType
Eq GraphQLQueryType
-> (GraphQLQueryType -> GraphQLQueryType -> Ordering)
-> (GraphQLQueryType -> GraphQLQueryType -> Bool)
-> (GraphQLQueryType -> GraphQLQueryType -> Bool)
-> (GraphQLQueryType -> GraphQLQueryType -> Bool)
-> (GraphQLQueryType -> GraphQLQueryType -> Bool)
-> (GraphQLQueryType -> GraphQLQueryType -> GraphQLQueryType)
-> (GraphQLQueryType -> GraphQLQueryType -> GraphQLQueryType)
-> Ord GraphQLQueryType
GraphQLQueryType -> GraphQLQueryType -> Bool
GraphQLQueryType -> GraphQLQueryType -> Ordering
GraphQLQueryType -> GraphQLQueryType -> GraphQLQueryType
forall a.
Eq a
-> (a -> a -> Ordering)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> Bool)
-> (a -> a -> a)
-> (a -> a -> a)
-> Ord a
$ccompare :: GraphQLQueryType -> GraphQLQueryType -> Ordering
compare :: GraphQLQueryType -> GraphQLQueryType -> Ordering
$c< :: GraphQLQueryType -> GraphQLQueryType -> Bool
< :: GraphQLQueryType -> GraphQLQueryType -> Bool
$c<= :: GraphQLQueryType -> GraphQLQueryType -> Bool
<= :: GraphQLQueryType -> GraphQLQueryType -> Bool
$c> :: GraphQLQueryType -> GraphQLQueryType -> Bool
> :: GraphQLQueryType -> GraphQLQueryType -> Bool
$c>= :: GraphQLQueryType -> GraphQLQueryType -> Bool
>= :: GraphQLQueryType -> GraphQLQueryType -> Bool
$cmax :: GraphQLQueryType -> GraphQLQueryType -> GraphQLQueryType
max :: GraphQLQueryType -> GraphQLQueryType -> GraphQLQueryType
$cmin :: GraphQLQueryType -> GraphQLQueryType -> GraphQLQueryType
min :: GraphQLQueryType -> GraphQLQueryType -> GraphQLQueryType
Ord, (forall x. GraphQLQueryType -> Rep GraphQLQueryType x)
-> (forall x. Rep GraphQLQueryType x -> GraphQLQueryType)
-> Generic GraphQLQueryType
forall x. Rep GraphQLQueryType x -> GraphQLQueryType
forall x. GraphQLQueryType -> Rep GraphQLQueryType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. GraphQLQueryType -> Rep GraphQLQueryType x
from :: forall x. GraphQLQueryType -> Rep GraphQLQueryType x
$cto :: forall x. Rep GraphQLQueryType x -> GraphQLQueryType
to :: forall x. Rep GraphQLQueryType x -> GraphQLQueryType
Generic)

instance Hashable GraphQLQueryType

instance J.ToJSON GraphQLQueryType where
  toJSON :: GraphQLQueryType -> Value
toJSON = \case
    GraphQLQueryType
QueryHasura -> Value
"hasura"
    GraphQLQueryType
QueryRelay -> Value
"relay"