{-# LANGUAGE MultiWayIf #-}
-- 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 #-}

-- | Contains the types generated from the schema Site
module RecurlyClient.Types.Site where

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.Internal
import qualified Data.Aeson as Data.Aeson.Types.ToJSON
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 RecurlyClient.Common
import RecurlyClient.TypeAlias
import {-# SOURCE #-} RecurlyClient.Types.Address
import {-# SOURCE #-} RecurlyClient.Types.Settings
import qualified Prelude as GHC.Integer.Type
import qualified Prelude as GHC.Maybe

-- | Defines the object schema located at @components.schemas.Site@ in the specification.
data Site = Site
    { Site -> Maybe Address
siteAddress :: (GHC.Maybe.Maybe Address)
    -- ^ address
    , Site -> Maybe JsonDateTime
siteCreated_at :: (GHC.Maybe.Maybe RecurlyClient.Common.JsonDateTime)
    -- ^ created_at
    , Site -> Maybe JsonDateTime
siteDeleted_at :: (GHC.Maybe.Maybe RecurlyClient.Common.JsonDateTime)
    -- ^ deleted_at
    , Site -> Maybe [SiteFeatures]
siteFeatures :: (GHC.Maybe.Maybe [SiteFeatures])
    -- ^ features: A list of features enabled for the site.
    , Site -> Maybe Text
siteId :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
    -- ^ id
    --
    -- Constraints:
    --
    -- * Maximum length of 13
    , Site -> Maybe SiteMode
siteMode :: (GHC.Maybe.Maybe SiteMode)
    -- ^ mode
    --
    -- Constraints:
    --
    -- * Maximum length of 15
    , Site -> Maybe Text
siteObject :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
    -- ^ object
    , Site -> Maybe Text
sitePublic_api_key :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
    -- ^ public_api_key: This value is used to configure RecurlyJS to submit tokenized billing information.
    --
    -- Constraints:
    --
    -- * Maximum length of 50
    , Site -> Maybe Settings
siteSettings :: (GHC.Maybe.Maybe Settings)
    -- ^ settings
    , Site -> Maybe Text
siteSubdomain :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
    -- ^ subdomain
    --
    -- Constraints:
    --
    -- * Maximum length of 100
    , Site -> Maybe JsonDateTime
siteUpdated_at :: (GHC.Maybe.Maybe RecurlyClient.Common.JsonDateTime)
    -- ^ updated_at
    }
    deriving
        ( Int -> Site -> ShowS
[Site] -> ShowS
Site -> String
(Int -> Site -> ShowS)
-> (Site -> String) -> ([Site] -> ShowS) -> Show Site
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Site -> ShowS
showsPrec :: Int -> Site -> ShowS
$cshow :: Site -> String
show :: Site -> String
$cshowList :: [Site] -> ShowS
showList :: [Site] -> ShowS
GHC.Show.Show
        , Site -> Site -> Bool
(Site -> Site -> Bool) -> (Site -> Site -> Bool) -> Eq Site
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Site -> Site -> Bool
== :: Site -> Site -> Bool
$c/= :: Site -> Site -> Bool
/= :: Site -> Site -> Bool
GHC.Classes.Eq
        )

instance Data.Aeson.Types.ToJSON.ToJSON Site where
    toJSON :: Site -> Value
toJSON Site
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object ([[Pair]] -> [Pair]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
Data.Foldable.concat ([Pair] -> (Address -> [Pair]) -> Maybe Address -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Address -> Pair) -> Address -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"address" Key -> Address -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (Site -> Maybe Address
siteAddress Site
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (JsonDateTime -> [Pair]) -> Maybe JsonDateTime -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair])
-> (JsonDateTime -> Pair) -> JsonDateTime -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"created_at" Key -> JsonDateTime -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (Site -> Maybe JsonDateTime
siteCreated_at Site
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (JsonDateTime -> [Pair]) -> Maybe JsonDateTime -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair])
-> (JsonDateTime -> Pair) -> JsonDateTime -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"deleted_at" Key -> JsonDateTime -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (Site -> Maybe JsonDateTime
siteDeleted_at Site
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair]
-> ([SiteFeatures] -> [Pair]) -> Maybe [SiteFeatures] -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair])
-> ([SiteFeatures] -> Pair) -> [SiteFeatures] -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"features" Key -> [SiteFeatures] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (Site -> Maybe [SiteFeatures]
siteFeatures Site
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Text -> [Pair]) -> Maybe Text -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Text -> Pair) -> Text -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"id" Key -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (Site -> Maybe Text
siteId Site
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (SiteMode -> [Pair]) -> Maybe SiteMode -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (SiteMode -> Pair) -> SiteMode -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"mode" Key -> SiteMode -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (Site -> Maybe SiteMode
siteMode Site
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Text -> [Pair]) -> Maybe Text -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Text -> Pair) -> Text -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"object" Key -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (Site -> Maybe Text
siteObject Site
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Text -> [Pair]) -> Maybe Text -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Text -> Pair) -> Text -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"public_api_key" Key -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (Site -> Maybe Text
sitePublic_api_key Site
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Settings -> [Pair]) -> Maybe Settings -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Settings -> Pair) -> Settings -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"settings" Key -> Settings -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (Site -> Maybe Settings
siteSettings Site
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (Text -> [Pair]) -> Maybe Text -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair]) -> (Text -> Pair) -> Text -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"subdomain" Key -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (Site -> Maybe Text
siteSubdomain Site
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair] -> (JsonDateTime -> [Pair]) -> Maybe JsonDateTime -> [Pair]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Pair]
forall a. Monoid a => a
GHC.Base.mempty (Pair -> [Pair]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Pair -> [Pair])
-> (JsonDateTime -> Pair) -> JsonDateTime -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"updated_at" Key -> JsonDateTime -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (Site -> Maybe JsonDateTime
siteUpdated_at Site
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [[Pair]]
forall a. Monoid a => a
GHC.Base.mempty))
    toEncoding :: Site -> Encoding
toEncoding Site
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ([Series] -> Series
forall a. Monoid a => [a] -> a
GHC.Base.mconcat ([[Series]] -> [Series]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
Data.Foldable.concat ([Series] -> (Address -> [Series]) -> Maybe Address -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Address -> Series) -> Address -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"address" Key -> Address -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (Site -> Maybe Address
siteAddress Site
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (JsonDateTime -> [Series]) -> Maybe JsonDateTime -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series])
-> (JsonDateTime -> Series) -> JsonDateTime -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"created_at" Key -> JsonDateTime -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (Site -> Maybe JsonDateTime
siteCreated_at Site
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (JsonDateTime -> [Series]) -> Maybe JsonDateTime -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series])
-> (JsonDateTime -> Series) -> JsonDateTime -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"deleted_at" Key -> JsonDateTime -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (Site -> Maybe JsonDateTime
siteDeleted_at Site
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> ([SiteFeatures] -> [Series]) -> Maybe [SiteFeatures] -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series])
-> ([SiteFeatures] -> Series) -> [SiteFeatures] -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"features" Key -> [SiteFeatures] -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (Site -> Maybe [SiteFeatures]
siteFeatures Site
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Text -> [Series]) -> Maybe Text -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Text -> Series) -> Text -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"id" Key -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (Site -> Maybe Text
siteId Site
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (SiteMode -> [Series]) -> Maybe SiteMode -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series])
-> (SiteMode -> Series) -> SiteMode -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"mode" Key -> SiteMode -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (Site -> Maybe SiteMode
siteMode Site
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Text -> [Series]) -> Maybe Text -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Text -> Series) -> Text -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"object" Key -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (Site -> Maybe Text
siteObject Site
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Text -> [Series]) -> Maybe Text -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Text -> Series) -> Text -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"public_api_key" Key -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (Site -> Maybe Text
sitePublic_api_key Site
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Settings -> [Series]) -> Maybe Settings -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series])
-> (Settings -> Series) -> Settings -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"settings" Key -> Settings -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (Site -> Maybe Settings
siteSettings Site
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series] -> (Text -> [Series]) -> Maybe Text -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series]) -> (Text -> Series) -> Text -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"subdomain" Key -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (Site -> Maybe Text
siteSubdomain Site
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (JsonDateTime -> [Series]) -> Maybe JsonDateTime -> [Series]
forall b a. b -> (a -> b) -> Maybe a -> b
Data.Maybe.maybe [Series]
forall a. Monoid a => a
GHC.Base.mempty (Series -> [Series]
forall a. a -> [a]
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure (Series -> [Series])
-> (JsonDateTime -> Series) -> JsonDateTime -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"updated_at" Key -> JsonDateTime -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (Site -> Maybe JsonDateTime
siteUpdated_at Site
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [[Series]]
forall a. Monoid a => a
GHC.Base.mempty)))
instance Data.Aeson.Types.FromJSON.FromJSON Site where
    parseJSON :: Value -> Parser Site
parseJSON = String -> (Object -> Parser Site) -> Value -> Parser Site
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"Site" (\Object
obj -> (((((((((((Maybe Address
 -> Maybe JsonDateTime
 -> Maybe JsonDateTime
 -> Maybe [SiteFeatures]
 -> Maybe Text
 -> Maybe SiteMode
 -> Maybe Text
 -> Maybe Text
 -> Maybe Settings
 -> Maybe Text
 -> Maybe JsonDateTime
 -> Site)
-> Parser
     (Maybe Address
      -> Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> Maybe [SiteFeatures]
      -> Maybe Text
      -> Maybe SiteMode
      -> Maybe Text
      -> Maybe Text
      -> Maybe Settings
      -> Maybe Text
      -> Maybe JsonDateTime
      -> Site)
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe Address
-> Maybe JsonDateTime
-> Maybe JsonDateTime
-> Maybe [SiteFeatures]
-> Maybe Text
-> Maybe SiteMode
-> Maybe Text
-> Maybe Text
-> Maybe Settings
-> Maybe Text
-> Maybe JsonDateTime
-> Site
Site Parser
  (Maybe Address
   -> Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> Maybe [SiteFeatures]
   -> Maybe Text
   -> Maybe SiteMode
   -> Maybe Text
   -> Maybe Text
   -> Maybe Settings
   -> Maybe Text
   -> Maybe JsonDateTime
   -> Site)
-> Parser (Maybe Address)
-> Parser
     (Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> Maybe [SiteFeatures]
      -> Maybe Text
      -> Maybe SiteMode
      -> Maybe Text
      -> Maybe Text
      -> Maybe Settings
      -> Maybe Text
      -> Maybe JsonDateTime
      -> Site)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Address)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"address")) Parser
  (Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> Maybe [SiteFeatures]
   -> Maybe Text
   -> Maybe SiteMode
   -> Maybe Text
   -> Maybe Text
   -> Maybe Settings
   -> Maybe Text
   -> Maybe JsonDateTime
   -> Site)
-> Parser (Maybe JsonDateTime)
-> Parser
     (Maybe JsonDateTime
      -> Maybe [SiteFeatures]
      -> Maybe Text
      -> Maybe SiteMode
      -> Maybe Text
      -> Maybe Text
      -> Maybe Settings
      -> Maybe Text
      -> Maybe JsonDateTime
      -> Site)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe JsonDateTime)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"created_at")) Parser
  (Maybe JsonDateTime
   -> Maybe [SiteFeatures]
   -> Maybe Text
   -> Maybe SiteMode
   -> Maybe Text
   -> Maybe Text
   -> Maybe Settings
   -> Maybe Text
   -> Maybe JsonDateTime
   -> Site)
-> Parser (Maybe JsonDateTime)
-> Parser
     (Maybe [SiteFeatures]
      -> Maybe Text
      -> Maybe SiteMode
      -> Maybe Text
      -> Maybe Text
      -> Maybe Settings
      -> Maybe Text
      -> Maybe JsonDateTime
      -> Site)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe JsonDateTime)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"deleted_at")) Parser
  (Maybe [SiteFeatures]
   -> Maybe Text
   -> Maybe SiteMode
   -> Maybe Text
   -> Maybe Text
   -> Maybe Settings
   -> Maybe Text
   -> Maybe JsonDateTime
   -> Site)
-> Parser (Maybe [SiteFeatures])
-> Parser
     (Maybe Text
      -> Maybe SiteMode
      -> Maybe Text
      -> Maybe Text
      -> Maybe Settings
      -> Maybe Text
      -> Maybe JsonDateTime
      -> Site)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe [SiteFeatures])
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"features")) Parser
  (Maybe Text
   -> Maybe SiteMode
   -> Maybe Text
   -> Maybe Text
   -> Maybe Settings
   -> Maybe Text
   -> Maybe JsonDateTime
   -> Site)
-> Parser (Maybe Text)
-> Parser
     (Maybe SiteMode
      -> Maybe Text
      -> Maybe Text
      -> Maybe Settings
      -> Maybe Text
      -> Maybe JsonDateTime
      -> Site)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"id")) Parser
  (Maybe SiteMode
   -> Maybe Text
   -> Maybe Text
   -> Maybe Settings
   -> Maybe Text
   -> Maybe JsonDateTime
   -> Site)
-> Parser (Maybe SiteMode)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Settings
      -> Maybe Text
      -> Maybe JsonDateTime
      -> Site)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe SiteMode)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"mode")) Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Settings
   -> Maybe Text
   -> Maybe JsonDateTime
   -> Site)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Settings -> Maybe Text -> Maybe JsonDateTime -> Site)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"object")) Parser
  (Maybe Text
   -> Maybe Settings -> Maybe Text -> Maybe JsonDateTime -> Site)
-> Parser (Maybe Text)
-> Parser
     (Maybe Settings -> Maybe Text -> Maybe JsonDateTime -> Site)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"public_api_key")) Parser (Maybe Settings -> Maybe Text -> Maybe JsonDateTime -> Site)
-> Parser (Maybe Settings)
-> Parser (Maybe Text -> Maybe JsonDateTime -> Site)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Settings)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"settings")) Parser (Maybe Text -> Maybe JsonDateTime -> Site)
-> Parser (Maybe Text) -> Parser (Maybe JsonDateTime -> Site)
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"subdomain")) Parser (Maybe JsonDateTime -> Site)
-> Parser (Maybe JsonDateTime) -> Parser Site
forall a b. Parser (a -> b) -> Parser a -> Parser b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Key -> Parser (Maybe JsonDateTime)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"updated_at"))

-- | Create a new 'Site' with all required fields.
mkSite :: Site
mkSite :: Site
mkSite =
    Site
        { siteAddress :: Maybe Address
siteAddress = Maybe Address
forall a. Maybe a
GHC.Maybe.Nothing
        , siteCreated_at :: Maybe JsonDateTime
siteCreated_at = Maybe JsonDateTime
forall a. Maybe a
GHC.Maybe.Nothing
        , siteDeleted_at :: Maybe JsonDateTime
siteDeleted_at = Maybe JsonDateTime
forall a. Maybe a
GHC.Maybe.Nothing
        , siteFeatures :: Maybe [SiteFeatures]
siteFeatures = Maybe [SiteFeatures]
forall a. Maybe a
GHC.Maybe.Nothing
        , siteId :: Maybe Text
siteId = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
        , siteMode :: Maybe SiteMode
siteMode = Maybe SiteMode
forall a. Maybe a
GHC.Maybe.Nothing
        , siteObject :: Maybe Text
siteObject = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
        , sitePublic_api_key :: Maybe Text
sitePublic_api_key = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
        , siteSettings :: Maybe Settings
siteSettings = Maybe Settings
forall a. Maybe a
GHC.Maybe.Nothing
        , siteSubdomain :: Maybe Text
siteSubdomain = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
        , siteUpdated_at :: Maybe JsonDateTime
siteUpdated_at = Maybe JsonDateTime
forall a. Maybe a
GHC.Maybe.Nothing
        }

-- | Defines the enum schema located at @components.schemas.Site.properties.features.items@ in the specification.
data SiteFeatures
    = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
      SiteFeaturesOther Data.Aeson.Types.Internal.Value
    | -- | This constructor can be used to send values to the server which are not present in the specification yet.
      SiteFeaturesTyped Data.Text.Internal.Text
    | -- | Represents the JSON value @"credit_memos"@
      SiteFeaturesEnumCredit_memos
    | -- | Represents the JSON value @"manual_invoicing"@
      SiteFeaturesEnumManual_invoicing
    | -- | Represents the JSON value @"only_bill_what_changed"@
      SiteFeaturesEnumOnly_bill_what_changed
    | -- | Represents the JSON value @"subscription_terms"@
      SiteFeaturesEnumSubscription_terms
    deriving (Int -> SiteFeatures -> ShowS
[SiteFeatures] -> ShowS
SiteFeatures -> String
(Int -> SiteFeatures -> ShowS)
-> (SiteFeatures -> String)
-> ([SiteFeatures] -> ShowS)
-> Show SiteFeatures
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SiteFeatures -> ShowS
showsPrec :: Int -> SiteFeatures -> ShowS
$cshow :: SiteFeatures -> String
show :: SiteFeatures -> String
$cshowList :: [SiteFeatures] -> ShowS
showList :: [SiteFeatures] -> ShowS
GHC.Show.Show, SiteFeatures -> SiteFeatures -> Bool
(SiteFeatures -> SiteFeatures -> Bool)
-> (SiteFeatures -> SiteFeatures -> Bool) -> Eq SiteFeatures
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SiteFeatures -> SiteFeatures -> Bool
== :: SiteFeatures -> SiteFeatures -> Bool
$c/= :: SiteFeatures -> SiteFeatures -> Bool
/= :: SiteFeatures -> SiteFeatures -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON SiteFeatures where
    toJSON :: SiteFeatures -> Value
toJSON (SiteFeaturesOther Value
val) = Value
val
    toJSON (SiteFeaturesTyped Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
    toJSON (SiteFeatures
SiteFeaturesEnumCredit_memos) = Value
"credit_memos"
    toJSON (SiteFeatures
SiteFeaturesEnumManual_invoicing) = Value
"manual_invoicing"
    toJSON (SiteFeatures
SiteFeaturesEnumOnly_bill_what_changed) = Value
"only_bill_what_changed"
    toJSON (SiteFeatures
SiteFeaturesEnumSubscription_terms) = Value
"subscription_terms"
instance Data.Aeson.Types.FromJSON.FromJSON SiteFeatures where
    parseJSON :: Value -> Parser SiteFeatures
parseJSON Value
val =
        SiteFeatures -> Parser SiteFeatures
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure
            ( if
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"credit_memos" -> SiteFeatures
SiteFeaturesEnumCredit_memos
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"manual_invoicing" -> SiteFeatures
SiteFeaturesEnumManual_invoicing
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"only_bill_what_changed" -> SiteFeatures
SiteFeaturesEnumOnly_bill_what_changed
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"subscription_terms" -> SiteFeatures
SiteFeaturesEnumSubscription_terms
                | Bool
GHC.Base.otherwise -> Value -> SiteFeatures
SiteFeaturesOther Value
val
            )

-- | Defines the enum schema located at @components.schemas.Site.properties.mode@ in the specification.
data SiteMode
    = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
      SiteModeOther Data.Aeson.Types.Internal.Value
    | -- | This constructor can be used to send values to the server which are not present in the specification yet.
      SiteModeTyped Data.Text.Internal.Text
    | -- | Represents the JSON value @"development"@
      SiteModeEnumDevelopment
    | -- | Represents the JSON value @"production"@
      SiteModeEnumProduction
    | -- | Represents the JSON value @"sandbox"@
      SiteModeEnumSandbox
    deriving (Int -> SiteMode -> ShowS
[SiteMode] -> ShowS
SiteMode -> String
(Int -> SiteMode -> ShowS)
-> (SiteMode -> String) -> ([SiteMode] -> ShowS) -> Show SiteMode
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> SiteMode -> ShowS
showsPrec :: Int -> SiteMode -> ShowS
$cshow :: SiteMode -> String
show :: SiteMode -> String
$cshowList :: [SiteMode] -> ShowS
showList :: [SiteMode] -> ShowS
GHC.Show.Show, SiteMode -> SiteMode -> Bool
(SiteMode -> SiteMode -> Bool)
-> (SiteMode -> SiteMode -> Bool) -> Eq SiteMode
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: SiteMode -> SiteMode -> Bool
== :: SiteMode -> SiteMode -> Bool
$c/= :: SiteMode -> SiteMode -> Bool
/= :: SiteMode -> SiteMode -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON SiteMode where
    toJSON :: SiteMode -> Value
toJSON (SiteModeOther Value
val) = Value
val
    toJSON (SiteModeTyped Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
    toJSON (SiteMode
SiteModeEnumDevelopment) = Value
"development"
    toJSON (SiteMode
SiteModeEnumProduction) = Value
"production"
    toJSON (SiteMode
SiteModeEnumSandbox) = Value
"sandbox"
instance Data.Aeson.Types.FromJSON.FromJSON SiteMode where
    parseJSON :: Value -> Parser SiteMode
parseJSON Value
val =
        SiteMode -> Parser SiteMode
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure
            ( if
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"development" -> SiteMode
SiteModeEnumDevelopment
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"production" -> SiteMode
SiteModeEnumProduction
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"sandbox" -> SiteMode
SiteModeEnumSandbox
                | Bool
GHC.Base.otherwise -> Value -> SiteMode
SiteModeOther Value
val
            )