{-# LANGUAGE DeriveAnyClass #-}

module Hercules.API.Inputs.ImmutableInput where

import Data.Aeson
  ( FromJSON (parseJSON),
    ToJSON (toEncoding, toJSON),
    genericParseJSON,
    genericToEncoding,
    genericToJSON,
  )
import Data.OpenApi qualified as O3
import Hercules.API.Inputs.ImmutableGitInput
import Hercules.API.Prelude

data ImmutableInput
  = GitInput ImmutableGitInput
  | IgnoreMe ()
  deriving ((forall x. ImmutableInput -> Rep ImmutableInput x)
-> (forall x. Rep ImmutableInput x -> ImmutableInput)
-> Generic ImmutableInput
forall x. Rep ImmutableInput x -> ImmutableInput
forall x. ImmutableInput -> Rep ImmutableInput x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. ImmutableInput -> Rep ImmutableInput x
from :: forall x. ImmutableInput -> Rep ImmutableInput x
$cto :: forall x. Rep ImmutableInput x -> ImmutableInput
to :: forall x. Rep ImmutableInput x -> ImmutableInput
Generic, Int -> ImmutableInput -> ShowS
[ImmutableInput] -> ShowS
ImmutableInput -> String
(Int -> ImmutableInput -> ShowS)
-> (ImmutableInput -> String)
-> ([ImmutableInput] -> ShowS)
-> Show ImmutableInput
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> ImmutableInput -> ShowS
showsPrec :: Int -> ImmutableInput -> ShowS
$cshow :: ImmutableInput -> String
show :: ImmutableInput -> String
$cshowList :: [ImmutableInput] -> ShowS
showList :: [ImmutableInput] -> ShowS
Show, ImmutableInput -> ImmutableInput -> Bool
(ImmutableInput -> ImmutableInput -> Bool)
-> (ImmutableInput -> ImmutableInput -> Bool) -> Eq ImmutableInput
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ImmutableInput -> ImmutableInput -> Bool
== :: ImmutableInput -> ImmutableInput -> Bool
$c/= :: ImmutableInput -> ImmutableInput -> Bool
/= :: ImmutableInput -> ImmutableInput -> Bool
Eq, ImmutableInput -> ()
(ImmutableInput -> ()) -> NFData ImmutableInput
forall a. (a -> ()) -> NFData a
$crnf :: ImmutableInput -> ()
rnf :: ImmutableInput -> ()
NFData, Proxy ImmutableInput -> Declare (Definitions Schema) NamedSchema
(Proxy ImmutableInput -> Declare (Definitions Schema) NamedSchema)
-> ToSchema ImmutableInput
forall a.
(Proxy a -> Declare (Definitions Schema) NamedSchema) -> ToSchema a
$cdeclareNamedSchema :: Proxy ImmutableInput -> Declare (Definitions Schema) NamedSchema
declareNamedSchema :: Proxy ImmutableInput -> Declare (Definitions Schema) NamedSchema
ToSchema, Typeable ImmutableInput
Typeable ImmutableInput =>
(Proxy ImmutableInput -> Declare (Definitions Schema) NamedSchema)
-> ToSchema ImmutableInput
Proxy ImmutableInput -> Declare (Definitions Schema) NamedSchema
forall a.
Typeable a =>
(Proxy a -> Declare (Definitions Schema) NamedSchema) -> ToSchema a
$cdeclareNamedSchema :: Proxy ImmutableInput -> Declare (Definitions Schema) NamedSchema
declareNamedSchema :: Proxy ImmutableInput -> Declare (Definitions Schema) NamedSchema
O3.ToSchema)

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

instance ToJSON ImmutableInput where
  toJSON :: ImmutableInput -> Value
toJSON = Options -> ImmutableInput -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
schemaCompatibleOptions

  toEncoding :: ImmutableInput -> Encoding
toEncoding = Options -> ImmutableInput -> Encoding
forall a.
(Generic a, GToJSON' Encoding Zero (Rep a)) =>
Options -> a -> Encoding
genericToEncoding Options
schemaCompatibleOptions