-- CHANGE WITH CAUTION: This is a generated code file generated by https://github.com/Haskell-OpenAPI-Code-Generator/Haskell-OpenAPI-Client-Code-Generator.

{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE MultiWayIf #-}

-- | Contains the types generated from the schema Test8
module OpenAPI.Types.Test8 where

import qualified Prelude as GHC.Integer.Type
import qualified Prelude as GHC.Maybe
import qualified Control.Monad.Fail
import qualified Data.Aeson
import qualified Data.Aeson as Data.Aeson.Encoding.Internal
import qualified Data.Aeson as Data.Aeson.Types
import qualified Data.Aeson as Data.Aeson.Types.FromJSON
import qualified Data.Aeson as Data.Aeson.Types.ToJSON
import qualified Data.Aeson as Data.Aeson.Types.Internal
import qualified Data.ByteString
import qualified Data.ByteString as Data.ByteString.Internal
import qualified Data.Foldable
import qualified Data.Functor
import qualified Data.Maybe
import qualified Data.Scientific
import qualified Data.Text
import qualified Data.Text as Data.Text.Internal
import qualified Data.Time.Calendar as Data.Time.Calendar.Days
import qualified Data.Time.LocalTime as Data.Time.LocalTime.Internal.ZonedTime
import qualified GHC.Base
import qualified GHC.Classes
import qualified GHC.Int
import qualified GHC.Show
import qualified GHC.Types
import qualified OpenAPI.Common
import OpenAPI.TypeAlias

-- | Defines the object schema located at @components.schemas.Test8@ in the specification.
-- 
-- 
data Test8NonNullable = Test8NonNullable {
  -- | prop1
  test8NonNullableProp1 :: (OpenAPI.Common.Nullable GHC.Types.Int)
  -- | prop2
  , test8NonNullableProp2 :: (GHC.Maybe.Maybe (OpenAPI.Common.Nullable Data.Text.Internal.Text))
  -- | prop3
  , test8NonNullableProp3 :: (OpenAPI.Common.Nullable [OpenAPI.Common.Nullable Data.Text.Internal.Text])
  } deriving (GHC.Show.Show
  , GHC.Classes.Eq)
instance Data.Aeson.Types.ToJSON.ToJSON Test8NonNullable
    where {toJSON obj = Data.Aeson.Types.Internal.object (Data.Foldable.concat (["prop1" Data.Aeson.Types.ToJSON..= test8NonNullableProp1 obj] : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("prop2" Data.Aeson.Types.ToJSON..=)) (test8NonNullableProp2 obj) : ["prop3" Data.Aeson.Types.ToJSON..= test8NonNullableProp3 obj] : GHC.Base.mempty));
           toEncoding obj = Data.Aeson.Encoding.Internal.pairs (GHC.Base.mconcat (Data.Foldable.concat (["prop1" Data.Aeson.Types.ToJSON..= test8NonNullableProp1 obj] : Data.Maybe.maybe GHC.Base.mempty (GHC.Base.pure GHC.Base.. ("prop2" Data.Aeson.Types.ToJSON..=)) (test8NonNullableProp2 obj) : ["prop3" Data.Aeson.Types.ToJSON..= test8NonNullableProp3 obj] : GHC.Base.mempty)))}
instance Data.Aeson.Types.FromJSON.FromJSON Test8NonNullable
    where {parseJSON = Data.Aeson.Types.FromJSON.withObject "Test8NonNullable" (\obj -> ((GHC.Base.pure Test8NonNullable GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "prop1")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..:! "prop2")) GHC.Base.<*> (obj Data.Aeson.Types.FromJSON..: "prop3"))}
-- | Create a new 'Test8NonNullable' with all required fields.
mkTest8NonNullable :: OpenAPI.Common.Nullable GHC.Types.Int -- ^ 'test8NonNullableProp1'
  -> OpenAPI.Common.Nullable [OpenAPI.Common.Nullable Data.Text.Internal.Text] -- ^ 'test8NonNullableProp3'
  -> Test8NonNullable
mkTest8NonNullable test8NonNullableProp1 test8NonNullableProp3 = Test8NonNullable{test8NonNullableProp1 = test8NonNullableProp1,
                                                                                  test8NonNullableProp2 = GHC.Maybe.Nothing,
                                                                                  test8NonNullableProp3 = test8NonNullableProp3}
-- | Defines a nullable type alias for 'Test8NonNullable' as the schema located at @components.schemas.Test8@ in the specification is marked as nullable.
type Test8 = OpenAPI.Common.Nullable Test8NonNullable
