{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE OverloadedStrings #-}
module RecurlyClient.Types.MeasuredUnit 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 qualified Prelude as GHC.Integer.Type
import qualified Prelude as GHC.Maybe
data MeasuredUnit = MeasuredUnit
{ MeasuredUnit -> Maybe JsonDateTime
measuredUnitCreated_at :: (GHC.Maybe.Maybe RecurlyClient.Common.JsonDateTime)
, MeasuredUnit -> Maybe JsonDateTime
measuredUnitDeleted_at :: (GHC.Maybe.Maybe RecurlyClient.Common.JsonDateTime)
, MeasuredUnit -> Maybe Text
measuredUnitDescription :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
, MeasuredUnit -> Maybe Text
measuredUnitDisplay_name :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
, MeasuredUnit -> Maybe Text
measuredUnitId :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
, MeasuredUnit -> Maybe Text
measuredUnitName :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
, MeasuredUnit -> Maybe Text
measuredUnitObject :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
, MeasuredUnit -> Maybe MeasuredUnitState
measuredUnitState :: (GHC.Maybe.Maybe MeasuredUnitState)
, MeasuredUnit -> Maybe JsonDateTime
measuredUnitUpdated_at :: (GHC.Maybe.Maybe RecurlyClient.Common.JsonDateTime)
}
deriving
( Int -> MeasuredUnit -> ShowS
[MeasuredUnit] -> ShowS
MeasuredUnit -> String
(Int -> MeasuredUnit -> ShowS)
-> (MeasuredUnit -> String)
-> ([MeasuredUnit] -> ShowS)
-> Show MeasuredUnit
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> MeasuredUnit -> ShowS
showsPrec :: Int -> MeasuredUnit -> ShowS
$cshow :: MeasuredUnit -> String
show :: MeasuredUnit -> String
$cshowList :: [MeasuredUnit] -> ShowS
showList :: [MeasuredUnit] -> ShowS
GHC.Show.Show
, MeasuredUnit -> MeasuredUnit -> Bool
(MeasuredUnit -> MeasuredUnit -> Bool)
-> (MeasuredUnit -> MeasuredUnit -> Bool) -> Eq MeasuredUnit
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: MeasuredUnit -> MeasuredUnit -> Bool
== :: MeasuredUnit -> MeasuredUnit -> Bool
$c/= :: MeasuredUnit -> MeasuredUnit -> Bool
/= :: MeasuredUnit -> MeasuredUnit -> Bool
GHC.Classes.Eq
)
instance Data.Aeson.Types.ToJSON.ToJSON MeasuredUnit where
toJSON :: MeasuredUnit -> Value
toJSON MeasuredUnit
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object ([[Pair]] -> [Pair]
forall (t :: * -> *) a. Foldable t => t [a] -> [a]
Data.Foldable.concat ([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..=)) (MeasuredUnit -> Maybe JsonDateTime
measuredUnitCreated_at MeasuredUnit
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..=)) (MeasuredUnit -> Maybe JsonDateTime
measuredUnitDeleted_at MeasuredUnit
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
"description" Key -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (MeasuredUnit -> Maybe Text
measuredUnitDescription MeasuredUnit
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
"display_name" Key -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (MeasuredUnit -> Maybe Text
measuredUnitDisplay_name MeasuredUnit
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..=)) (MeasuredUnit -> Maybe Text
measuredUnitId MeasuredUnit
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
"name" Key -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (MeasuredUnit -> Maybe Text
measuredUnitName MeasuredUnit
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..=)) (MeasuredUnit -> Maybe Text
measuredUnitObject MeasuredUnit
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair]
-> (MeasuredUnitState -> [Pair])
-> Maybe MeasuredUnitState
-> [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])
-> (MeasuredUnitState -> Pair) -> MeasuredUnitState -> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"state" Key -> MeasuredUnitState -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (MeasuredUnit -> Maybe MeasuredUnitState
measuredUnitState MeasuredUnit
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..=)) (MeasuredUnit -> Maybe JsonDateTime
measuredUnitUpdated_at MeasuredUnit
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [[Pair]]
forall a. Monoid a => a
GHC.Base.mempty))
toEncoding :: MeasuredUnit -> Encoding
toEncoding MeasuredUnit
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]
-> (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..=)) (MeasuredUnit -> Maybe JsonDateTime
measuredUnitCreated_at MeasuredUnit
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..=)) (MeasuredUnit -> Maybe JsonDateTime
measuredUnitDeleted_at MeasuredUnit
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
"description" Key -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (MeasuredUnit -> Maybe Text
measuredUnitDescription MeasuredUnit
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
"display_name" Key -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (MeasuredUnit -> Maybe Text
measuredUnitDisplay_name MeasuredUnit
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..=)) (MeasuredUnit -> Maybe Text
measuredUnitId MeasuredUnit
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
"name" Key -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (MeasuredUnit -> Maybe Text
measuredUnitName MeasuredUnit
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..=)) (MeasuredUnit -> Maybe Text
measuredUnitObject MeasuredUnit
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (MeasuredUnitState -> [Series])
-> Maybe MeasuredUnitState
-> [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])
-> (MeasuredUnitState -> Series) -> MeasuredUnitState -> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"state" Key -> MeasuredUnitState -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (MeasuredUnit -> Maybe MeasuredUnitState
measuredUnitState MeasuredUnit
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..=)) (MeasuredUnit -> Maybe JsonDateTime
measuredUnitUpdated_at MeasuredUnit
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [[Series]]
forall a. Monoid a => a
GHC.Base.mempty)))
instance Data.Aeson.Types.FromJSON.FromJSON MeasuredUnit where
parseJSON :: Value -> Parser MeasuredUnit
parseJSON = String
-> (Object -> Parser MeasuredUnit) -> Value -> Parser MeasuredUnit
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"MeasuredUnit" (\Object
obj -> (((((((((Maybe JsonDateTime
-> Maybe JsonDateTime
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe MeasuredUnitState
-> Maybe JsonDateTime
-> MeasuredUnit)
-> Parser
(Maybe JsonDateTime
-> Maybe JsonDateTime
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe MeasuredUnitState
-> Maybe JsonDateTime
-> MeasuredUnit)
forall a. a -> Parser a
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe JsonDateTime
-> Maybe JsonDateTime
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe MeasuredUnitState
-> Maybe JsonDateTime
-> MeasuredUnit
MeasuredUnit Parser
(Maybe JsonDateTime
-> Maybe JsonDateTime
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe MeasuredUnitState
-> Maybe JsonDateTime
-> MeasuredUnit)
-> Parser (Maybe JsonDateTime)
-> Parser
(Maybe JsonDateTime
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe MeasuredUnitState
-> Maybe JsonDateTime
-> MeasuredUnit)
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 Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe MeasuredUnitState
-> Maybe JsonDateTime
-> MeasuredUnit)
-> Parser (Maybe JsonDateTime)
-> Parser
(Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe MeasuredUnitState
-> Maybe JsonDateTime
-> MeasuredUnit)
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 Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe MeasuredUnitState
-> Maybe JsonDateTime
-> MeasuredUnit)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe MeasuredUnitState
-> Maybe JsonDateTime
-> MeasuredUnit)
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
"description")) Parser
(Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe MeasuredUnitState
-> Maybe JsonDateTime
-> MeasuredUnit)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe MeasuredUnitState
-> Maybe JsonDateTime
-> MeasuredUnit)
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
"display_name")) Parser
(Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe MeasuredUnitState
-> Maybe JsonDateTime
-> MeasuredUnit)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe Text
-> Maybe MeasuredUnitState
-> Maybe JsonDateTime
-> MeasuredUnit)
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 Text
-> Maybe Text
-> Maybe MeasuredUnitState
-> Maybe JsonDateTime
-> MeasuredUnit)
-> Parser (Maybe Text)
-> Parser
(Maybe Text
-> Maybe MeasuredUnitState -> Maybe JsonDateTime -> MeasuredUnit)
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
"name")) Parser
(Maybe Text
-> Maybe MeasuredUnitState -> Maybe JsonDateTime -> MeasuredUnit)
-> Parser (Maybe Text)
-> Parser
(Maybe MeasuredUnitState -> Maybe JsonDateTime -> MeasuredUnit)
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 MeasuredUnitState -> Maybe JsonDateTime -> MeasuredUnit)
-> Parser (Maybe MeasuredUnitState)
-> Parser (Maybe JsonDateTime -> MeasuredUnit)
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 MeasuredUnitState)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"state")) Parser (Maybe JsonDateTime -> MeasuredUnit)
-> Parser (Maybe JsonDateTime) -> Parser MeasuredUnit
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"))
mkMeasuredUnit :: MeasuredUnit
mkMeasuredUnit :: MeasuredUnit
mkMeasuredUnit =
MeasuredUnit
{ measuredUnitCreated_at :: Maybe JsonDateTime
measuredUnitCreated_at = Maybe JsonDateTime
forall a. Maybe a
GHC.Maybe.Nothing
, measuredUnitDeleted_at :: Maybe JsonDateTime
measuredUnitDeleted_at = Maybe JsonDateTime
forall a. Maybe a
GHC.Maybe.Nothing
, measuredUnitDescription :: Maybe Text
measuredUnitDescription = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
, measuredUnitDisplay_name :: Maybe Text
measuredUnitDisplay_name = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
, measuredUnitId :: Maybe Text
measuredUnitId = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
, measuredUnitName :: Maybe Text
measuredUnitName = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
, measuredUnitObject :: Maybe Text
measuredUnitObject = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
, measuredUnitState :: Maybe MeasuredUnitState
measuredUnitState = Maybe MeasuredUnitState
forall a. Maybe a
GHC.Maybe.Nothing
, measuredUnitUpdated_at :: Maybe JsonDateTime
measuredUnitUpdated_at = Maybe JsonDateTime
forall a. Maybe a
GHC.Maybe.Nothing
}
data MeasuredUnitState
=
MeasuredUnitStateOther Data.Aeson.Types.Internal.Value
|
MeasuredUnitStateTyped Data.Text.Internal.Text
|
MeasuredUnitStateEnumActive
|
MeasuredUnitStateEnumInactive
deriving (Int -> MeasuredUnitState -> ShowS
[MeasuredUnitState] -> ShowS
MeasuredUnitState -> String
(Int -> MeasuredUnitState -> ShowS)
-> (MeasuredUnitState -> String)
-> ([MeasuredUnitState] -> ShowS)
-> Show MeasuredUnitState
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> MeasuredUnitState -> ShowS
showsPrec :: Int -> MeasuredUnitState -> ShowS
$cshow :: MeasuredUnitState -> String
show :: MeasuredUnitState -> String
$cshowList :: [MeasuredUnitState] -> ShowS
showList :: [MeasuredUnitState] -> ShowS
GHC.Show.Show, MeasuredUnitState -> MeasuredUnitState -> Bool
(MeasuredUnitState -> MeasuredUnitState -> Bool)
-> (MeasuredUnitState -> MeasuredUnitState -> Bool)
-> Eq MeasuredUnitState
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: MeasuredUnitState -> MeasuredUnitState -> Bool
== :: MeasuredUnitState -> MeasuredUnitState -> Bool
$c/= :: MeasuredUnitState -> MeasuredUnitState -> Bool
/= :: MeasuredUnitState -> MeasuredUnitState -> Bool
GHC.Classes.Eq)
instance Data.Aeson.Types.ToJSON.ToJSON MeasuredUnitState where
toJSON :: MeasuredUnitState -> Value
toJSON (MeasuredUnitStateOther Value
val) = Value
val
toJSON (MeasuredUnitStateTyped Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
toJSON (MeasuredUnitState
MeasuredUnitStateEnumActive) = Value
"active"
toJSON (MeasuredUnitState
MeasuredUnitStateEnumInactive) = Value
"inactive"
instance Data.Aeson.Types.FromJSON.FromJSON MeasuredUnitState where
parseJSON :: Value -> Parser MeasuredUnitState
parseJSON Value
val =
MeasuredUnitState -> Parser MeasuredUnitState
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
"active" -> MeasuredUnitState
MeasuredUnitStateEnumActive
| Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"inactive" -> MeasuredUnitState
MeasuredUnitStateEnumInactive
| Bool
GHC.Base.otherwise -> Value -> MeasuredUnitState
MeasuredUnitStateOther Value
val
)