module Hasura.RQL.Types.GraphqlSchemaIntrospection
  ( SetGraphqlIntrospectionOptions (..),
  )
where

import Autodocodec (HasCodec (codec), dimapCodec)
import Autodocodec.Extended (hashSetCodec)
import Data.Aeson (FromJSON (..), ToJSON (..), genericParseJSON, genericToEncoding, genericToJSON)
import Data.HashSet qualified as Set
import Hasura.Prelude
import Hasura.RQL.Types.Roles (RoleName)

newtype SetGraphqlIntrospectionOptions = SetGraphqlIntrospectionOptions {SetGraphqlIntrospectionOptions -> HashSet RoleName
_idrDisabledForRoles :: (Set.HashSet RoleName)}
  deriving (Int -> SetGraphqlIntrospectionOptions -> ShowS
[SetGraphqlIntrospectionOptions] -> ShowS
SetGraphqlIntrospectionOptions -> String
(Int -> SetGraphqlIntrospectionOptions -> ShowS)
-> (SetGraphqlIntrospectionOptions -> String)
-> ([SetGraphqlIntrospectionOptions] -> ShowS)
-> Show SetGraphqlIntrospectionOptions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SetGraphqlIntrospectionOptions -> ShowS
showsPrec :: Int -> SetGraphqlIntrospectionOptions -> ShowS
$cshow :: SetGraphqlIntrospectionOptions -> String
show :: SetGraphqlIntrospectionOptions -> String
$cshowList :: [SetGraphqlIntrospectionOptions] -> ShowS
showList :: [SetGraphqlIntrospectionOptions] -> ShowS
Show, SetGraphqlIntrospectionOptions
-> SetGraphqlIntrospectionOptions -> Bool
(SetGraphqlIntrospectionOptions
 -> SetGraphqlIntrospectionOptions -> Bool)
-> (SetGraphqlIntrospectionOptions
    -> SetGraphqlIntrospectionOptions -> Bool)
-> Eq SetGraphqlIntrospectionOptions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SetGraphqlIntrospectionOptions
-> SetGraphqlIntrospectionOptions -> Bool
== :: SetGraphqlIntrospectionOptions
-> SetGraphqlIntrospectionOptions -> Bool
$c/= :: SetGraphqlIntrospectionOptions
-> SetGraphqlIntrospectionOptions -> Bool
/= :: SetGraphqlIntrospectionOptions
-> SetGraphqlIntrospectionOptions -> Bool
Eq, (forall x.
 SetGraphqlIntrospectionOptions
 -> Rep SetGraphqlIntrospectionOptions x)
-> (forall x.
    Rep SetGraphqlIntrospectionOptions x
    -> SetGraphqlIntrospectionOptions)
-> Generic SetGraphqlIntrospectionOptions
forall x.
Rep SetGraphqlIntrospectionOptions x
-> SetGraphqlIntrospectionOptions
forall x.
SetGraphqlIntrospectionOptions
-> Rep SetGraphqlIntrospectionOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x.
SetGraphqlIntrospectionOptions
-> Rep SetGraphqlIntrospectionOptions x
from :: forall x.
SetGraphqlIntrospectionOptions
-> Rep SetGraphqlIntrospectionOptions x
$cto :: forall x.
Rep SetGraphqlIntrospectionOptions x
-> SetGraphqlIntrospectionOptions
to :: forall x.
Rep SetGraphqlIntrospectionOptions x
-> SetGraphqlIntrospectionOptions
Generic, NonEmpty SetGraphqlIntrospectionOptions
-> SetGraphqlIntrospectionOptions
SetGraphqlIntrospectionOptions
-> SetGraphqlIntrospectionOptions -> SetGraphqlIntrospectionOptions
(SetGraphqlIntrospectionOptions
 -> SetGraphqlIntrospectionOptions
 -> SetGraphqlIntrospectionOptions)
-> (NonEmpty SetGraphqlIntrospectionOptions
    -> SetGraphqlIntrospectionOptions)
-> (forall b.
    Integral b =>
    b
    -> SetGraphqlIntrospectionOptions
    -> SetGraphqlIntrospectionOptions)
-> Semigroup SetGraphqlIntrospectionOptions
forall b.
Integral b =>
b
-> SetGraphqlIntrospectionOptions -> SetGraphqlIntrospectionOptions
forall a.
(a -> a -> a)
-> (NonEmpty a -> a)
-> (forall b. Integral b => b -> a -> a)
-> Semigroup a
$c<> :: SetGraphqlIntrospectionOptions
-> SetGraphqlIntrospectionOptions -> SetGraphqlIntrospectionOptions
<> :: SetGraphqlIntrospectionOptions
-> SetGraphqlIntrospectionOptions -> SetGraphqlIntrospectionOptions
$csconcat :: NonEmpty SetGraphqlIntrospectionOptions
-> SetGraphqlIntrospectionOptions
sconcat :: NonEmpty SetGraphqlIntrospectionOptions
-> SetGraphqlIntrospectionOptions
$cstimes :: forall b.
Integral b =>
b
-> SetGraphqlIntrospectionOptions -> SetGraphqlIntrospectionOptions
stimes :: forall b.
Integral b =>
b
-> SetGraphqlIntrospectionOptions -> SetGraphqlIntrospectionOptions
Semigroup, Semigroup SetGraphqlIntrospectionOptions
SetGraphqlIntrospectionOptions
Semigroup SetGraphqlIntrospectionOptions
-> SetGraphqlIntrospectionOptions
-> (SetGraphqlIntrospectionOptions
    -> SetGraphqlIntrospectionOptions
    -> SetGraphqlIntrospectionOptions)
-> ([SetGraphqlIntrospectionOptions]
    -> SetGraphqlIntrospectionOptions)
-> Monoid SetGraphqlIntrospectionOptions
[SetGraphqlIntrospectionOptions] -> SetGraphqlIntrospectionOptions
SetGraphqlIntrospectionOptions
-> SetGraphqlIntrospectionOptions -> SetGraphqlIntrospectionOptions
forall a.
Semigroup a -> a -> (a -> a -> a) -> ([a] -> a) -> Monoid a
$cmempty :: SetGraphqlIntrospectionOptions
mempty :: SetGraphqlIntrospectionOptions
$cmappend :: SetGraphqlIntrospectionOptions
-> SetGraphqlIntrospectionOptions -> SetGraphqlIntrospectionOptions
mappend :: SetGraphqlIntrospectionOptions
-> SetGraphqlIntrospectionOptions -> SetGraphqlIntrospectionOptions
$cmconcat :: [SetGraphqlIntrospectionOptions] -> SetGraphqlIntrospectionOptions
mconcat :: [SetGraphqlIntrospectionOptions] -> SetGraphqlIntrospectionOptions
Monoid)

instance NFData SetGraphqlIntrospectionOptions

instance Hashable SetGraphqlIntrospectionOptions

instance HasCodec SetGraphqlIntrospectionOptions where
  codec :: JSONCodec SetGraphqlIntrospectionOptions
codec = (HashSet RoleName -> SetGraphqlIntrospectionOptions)
-> (SetGraphqlIntrospectionOptions -> HashSet RoleName)
-> Codec Value (HashSet RoleName) (HashSet RoleName)
-> JSONCodec SetGraphqlIntrospectionOptions
forall oldOutput newOutput newInput oldInput context.
(oldOutput -> newOutput)
-> (newInput -> oldInput)
-> Codec context oldInput oldOutput
-> Codec context newInput newOutput
dimapCodec HashSet RoleName -> SetGraphqlIntrospectionOptions
SetGraphqlIntrospectionOptions SetGraphqlIntrospectionOptions -> HashSet RoleName
_idrDisabledForRoles Codec Value (HashSet RoleName) (HashSet RoleName)
forall a. (Hashable a, HasCodec a) => JSONCodec (HashSet a)
hashSetCodec

instance FromJSON SetGraphqlIntrospectionOptions where
  parseJSON :: Value -> Parser SetGraphqlIntrospectionOptions
parseJSON = Options -> Value -> Parser SetGraphqlIntrospectionOptions
forall a.
(Generic a, GFromJSON Zero (Rep a)) =>
Options -> Value -> Parser a
genericParseJSON Options
hasuraJSON

instance ToJSON SetGraphqlIntrospectionOptions where
  toJSON :: SetGraphqlIntrospectionOptions -> Value
toJSON = Options -> SetGraphqlIntrospectionOptions -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
hasuraJSON
  toEncoding :: SetGraphqlIntrospectionOptions -> Encoding
toEncoding = Options -> SetGraphqlIntrospectionOptions -> Encoding
forall a.
(Generic a, GToJSON' Encoding Zero (Rep a)) =>
Options -> a -> Encoding
genericToEncoding Options
hasuraJSON