{-# 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 CustomFieldDefinition
module RecurlyClient.Types.CustomFieldDefinition 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

-- | Defines the object schema located at @components.schemas.CustomFieldDefinition@ in the specification.
data CustomFieldDefinition = CustomFieldDefinition
    { CustomFieldDefinition -> Maybe JsonDateTime
customFieldDefinitionCreated_at :: (GHC.Maybe.Maybe RecurlyClient.Common.JsonDateTime)
    -- ^ created_at
    , CustomFieldDefinition -> Maybe JsonDateTime
customFieldDefinitionDeleted_at :: (GHC.Maybe.Maybe RecurlyClient.Common.JsonDateTime)
    -- ^ deleted_at: Definitions are initially soft deleted, and once all the values are removed from the accouts or subscriptions, will be hard deleted an no longer visible.
    , CustomFieldDefinition -> Maybe Text
customFieldDefinitionDisplay_name :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
    -- ^ display_name: Used to label the field when viewing and editing the field in Recurly\'s admin UI.
    --
    -- Constraints:
    --
    -- * Maximum length of 50
    , CustomFieldDefinition -> Maybe Text
customFieldDefinitionId :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
    -- ^ id
    , CustomFieldDefinition -> Maybe Text
customFieldDefinitionName :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
    -- ^ name: Used by the API to identify the field or reading and writing. The name can only be used once per Recurly object type.
    --
    -- Constraints:
    --
    -- * Maximum length of 50
    -- * Must match pattern \'\/^[a-z0-9_-]+\$\/i\'
    , CustomFieldDefinition -> Maybe Text
customFieldDefinitionObject :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
    -- ^ object
    , CustomFieldDefinition -> Maybe CustomFieldDefinitionRelated_type
customFieldDefinitionRelated_type :: (GHC.Maybe.Maybe CustomFieldDefinitionRelated_type)
    -- ^ related_type
    , CustomFieldDefinition -> Maybe Text
customFieldDefinitionTooltip :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
    -- ^ tooltip: Displayed as a tooltip when editing the field in the Recurly admin UI.
    --
    -- Constraints:
    --
    -- * Maximum length of 255
    -- * Must match pattern \'\/^[a-z0-9_-]+\$\/i\'
    , CustomFieldDefinition -> Maybe JsonDateTime
customFieldDefinitionUpdated_at :: (GHC.Maybe.Maybe RecurlyClient.Common.JsonDateTime)
    -- ^ updated_at
    , CustomFieldDefinition -> Maybe CustomFieldDefinitionUser_access
customFieldDefinitionUser_access :: (GHC.Maybe.Maybe CustomFieldDefinitionUser_access)
    -- ^ user_access: The access control applied inside Recurly\'s admin UI:
    -- - \`api_only\` - No one will be able to view or edit this field\'s data via the admin UI.
    -- - \`read_only\` - Users with the Customers role will be able to view this field\'s data via the admin UI, but
    --   editing will only be available via the API.
    -- - \`write\` - Users with the Customers role will be able to view and edit this field\'s data via the admin UI.
    -- - \`set_only\` - Users with the Customers role will be able to set this field\'s data via the admin console.
    }
    deriving
        ( Int -> CustomFieldDefinition -> ShowS
[CustomFieldDefinition] -> ShowS
CustomFieldDefinition -> String
(Int -> CustomFieldDefinition -> ShowS)
-> (CustomFieldDefinition -> String)
-> ([CustomFieldDefinition] -> ShowS)
-> Show CustomFieldDefinition
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CustomFieldDefinition -> ShowS
showsPrec :: Int -> CustomFieldDefinition -> ShowS
$cshow :: CustomFieldDefinition -> String
show :: CustomFieldDefinition -> String
$cshowList :: [CustomFieldDefinition] -> ShowS
showList :: [CustomFieldDefinition] -> ShowS
GHC.Show.Show
        , CustomFieldDefinition -> CustomFieldDefinition -> Bool
(CustomFieldDefinition -> CustomFieldDefinition -> Bool)
-> (CustomFieldDefinition -> CustomFieldDefinition -> Bool)
-> Eq CustomFieldDefinition
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CustomFieldDefinition -> CustomFieldDefinition -> Bool
== :: CustomFieldDefinition -> CustomFieldDefinition -> Bool
$c/= :: CustomFieldDefinition -> CustomFieldDefinition -> Bool
/= :: CustomFieldDefinition -> CustomFieldDefinition -> Bool
GHC.Classes.Eq
        )

instance Data.Aeson.Types.ToJSON.ToJSON CustomFieldDefinition where
    toJSON :: CustomFieldDefinition -> Value
toJSON CustomFieldDefinition
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..=)) (CustomFieldDefinition -> Maybe JsonDateTime
customFieldDefinitionCreated_at CustomFieldDefinition
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..=)) (CustomFieldDefinition -> Maybe JsonDateTime
customFieldDefinitionDeleted_at CustomFieldDefinition
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..=)) (CustomFieldDefinition -> Maybe Text
customFieldDefinitionDisplay_name CustomFieldDefinition
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..=)) (CustomFieldDefinition -> Maybe Text
customFieldDefinitionId CustomFieldDefinition
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..=)) (CustomFieldDefinition -> Maybe Text
customFieldDefinitionName CustomFieldDefinition
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..=)) (CustomFieldDefinition -> Maybe Text
customFieldDefinitionObject CustomFieldDefinition
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair]
-> (CustomFieldDefinitionRelated_type -> [Pair])
-> Maybe CustomFieldDefinitionRelated_type
-> [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])
-> (CustomFieldDefinitionRelated_type -> Pair)
-> CustomFieldDefinitionRelated_type
-> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"related_type" Key -> CustomFieldDefinitionRelated_type -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (CustomFieldDefinition -> Maybe CustomFieldDefinitionRelated_type
customFieldDefinitionRelated_type CustomFieldDefinition
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
"tooltip" Key -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (CustomFieldDefinition -> Maybe Text
customFieldDefinitionTooltip CustomFieldDefinition
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..=)) (CustomFieldDefinition -> Maybe JsonDateTime
customFieldDefinitionUpdated_at CustomFieldDefinition
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [Pair]
-> (CustomFieldDefinitionUser_access -> [Pair])
-> Maybe CustomFieldDefinitionUser_access
-> [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])
-> (CustomFieldDefinitionUser_access -> Pair)
-> CustomFieldDefinitionUser_access
-> [Pair]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"user_access" Key -> CustomFieldDefinitionUser_access -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Pair
Data.Aeson.Types.ToJSON..=)) (CustomFieldDefinition -> Maybe CustomFieldDefinitionUser_access
customFieldDefinitionUser_access CustomFieldDefinition
obj) [Pair] -> [[Pair]] -> [[Pair]]
forall a. a -> [a] -> [a]
: [[Pair]]
forall a. Monoid a => a
GHC.Base.mempty))
    toEncoding :: CustomFieldDefinition -> Encoding
toEncoding CustomFieldDefinition
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..=)) (CustomFieldDefinition -> Maybe JsonDateTime
customFieldDefinitionCreated_at CustomFieldDefinition
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..=)) (CustomFieldDefinition -> Maybe JsonDateTime
customFieldDefinitionDeleted_at CustomFieldDefinition
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..=)) (CustomFieldDefinition -> Maybe Text
customFieldDefinitionDisplay_name CustomFieldDefinition
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..=)) (CustomFieldDefinition -> Maybe Text
customFieldDefinitionId CustomFieldDefinition
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..=)) (CustomFieldDefinition -> Maybe Text
customFieldDefinitionName CustomFieldDefinition
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..=)) (CustomFieldDefinition -> Maybe Text
customFieldDefinitionObject CustomFieldDefinition
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (CustomFieldDefinitionRelated_type -> [Series])
-> Maybe CustomFieldDefinitionRelated_type
-> [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])
-> (CustomFieldDefinitionRelated_type -> Series)
-> CustomFieldDefinitionRelated_type
-> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"related_type" Key -> CustomFieldDefinitionRelated_type -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (CustomFieldDefinition -> Maybe CustomFieldDefinitionRelated_type
customFieldDefinitionRelated_type CustomFieldDefinition
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
"tooltip" Key -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (CustomFieldDefinition -> Maybe Text
customFieldDefinitionTooltip CustomFieldDefinition
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..=)) (CustomFieldDefinition -> Maybe JsonDateTime
customFieldDefinitionUpdated_at CustomFieldDefinition
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [Series]
-> (CustomFieldDefinitionUser_access -> [Series])
-> Maybe CustomFieldDefinitionUser_access
-> [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])
-> (CustomFieldDefinitionUser_access -> Series)
-> CustomFieldDefinitionUser_access
-> [Series]
forall b c a. (b -> c) -> (a -> b) -> a -> c
GHC.Base.. (Key
"user_access" Key -> CustomFieldDefinitionUser_access -> Series
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
forall v. ToJSON v => Key -> v -> Series
Data.Aeson.Types.ToJSON..=)) (CustomFieldDefinition -> Maybe CustomFieldDefinitionUser_access
customFieldDefinitionUser_access CustomFieldDefinition
obj) [Series] -> [[Series]] -> [[Series]]
forall a. a -> [a] -> [a]
: [[Series]]
forall a. Monoid a => a
GHC.Base.mempty)))
instance Data.Aeson.Types.FromJSON.FromJSON CustomFieldDefinition where
    parseJSON :: Value -> Parser CustomFieldDefinition
parseJSON = String
-> (Object -> Parser CustomFieldDefinition)
-> Value
-> Parser CustomFieldDefinition
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"CustomFieldDefinition" (\Object
obj -> ((((((((((Maybe JsonDateTime
 -> Maybe JsonDateTime
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe CustomFieldDefinitionRelated_type
 -> Maybe Text
 -> Maybe JsonDateTime
 -> Maybe CustomFieldDefinitionUser_access
 -> CustomFieldDefinition)
-> Parser
     (Maybe JsonDateTime
      -> Maybe JsonDateTime
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe CustomFieldDefinitionRelated_type
      -> Maybe Text
      -> Maybe JsonDateTime
      -> Maybe CustomFieldDefinitionUser_access
      -> CustomFieldDefinition)
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 CustomFieldDefinitionRelated_type
-> Maybe Text
-> Maybe JsonDateTime
-> Maybe CustomFieldDefinitionUser_access
-> CustomFieldDefinition
CustomFieldDefinition Parser
  (Maybe JsonDateTime
   -> Maybe JsonDateTime
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe CustomFieldDefinitionRelated_type
   -> Maybe Text
   -> Maybe JsonDateTime
   -> Maybe CustomFieldDefinitionUser_access
   -> CustomFieldDefinition)
-> Parser (Maybe JsonDateTime)
-> Parser
     (Maybe JsonDateTime
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe CustomFieldDefinitionRelated_type
      -> Maybe Text
      -> Maybe JsonDateTime
      -> Maybe CustomFieldDefinitionUser_access
      -> CustomFieldDefinition)
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 CustomFieldDefinitionRelated_type
   -> Maybe Text
   -> Maybe JsonDateTime
   -> Maybe CustomFieldDefinitionUser_access
   -> CustomFieldDefinition)
-> Parser (Maybe JsonDateTime)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe CustomFieldDefinitionRelated_type
      -> Maybe Text
      -> Maybe JsonDateTime
      -> Maybe CustomFieldDefinitionUser_access
      -> CustomFieldDefinition)
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 CustomFieldDefinitionRelated_type
   -> Maybe Text
   -> Maybe JsonDateTime
   -> Maybe CustomFieldDefinitionUser_access
   -> CustomFieldDefinition)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe CustomFieldDefinitionRelated_type
      -> Maybe Text
      -> Maybe JsonDateTime
      -> Maybe CustomFieldDefinitionUser_access
      -> CustomFieldDefinition)
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 CustomFieldDefinitionRelated_type
   -> Maybe Text
   -> Maybe JsonDateTime
   -> Maybe CustomFieldDefinitionUser_access
   -> CustomFieldDefinition)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe CustomFieldDefinitionRelated_type
      -> Maybe Text
      -> Maybe JsonDateTime
      -> Maybe CustomFieldDefinitionUser_access
      -> CustomFieldDefinition)
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 CustomFieldDefinitionRelated_type
   -> Maybe Text
   -> Maybe JsonDateTime
   -> Maybe CustomFieldDefinitionUser_access
   -> CustomFieldDefinition)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe CustomFieldDefinitionRelated_type
      -> Maybe Text
      -> Maybe JsonDateTime
      -> Maybe CustomFieldDefinitionUser_access
      -> CustomFieldDefinition)
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 CustomFieldDefinitionRelated_type
   -> Maybe Text
   -> Maybe JsonDateTime
   -> Maybe CustomFieldDefinitionUser_access
   -> CustomFieldDefinition)
-> Parser (Maybe Text)
-> Parser
     (Maybe CustomFieldDefinitionRelated_type
      -> Maybe Text
      -> Maybe JsonDateTime
      -> Maybe CustomFieldDefinitionUser_access
      -> CustomFieldDefinition)
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 CustomFieldDefinitionRelated_type
   -> Maybe Text
   -> Maybe JsonDateTime
   -> Maybe CustomFieldDefinitionUser_access
   -> CustomFieldDefinition)
-> Parser (Maybe CustomFieldDefinitionRelated_type)
-> Parser
     (Maybe Text
      -> Maybe JsonDateTime
      -> Maybe CustomFieldDefinitionUser_access
      -> CustomFieldDefinition)
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 CustomFieldDefinitionRelated_type)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"related_type")) Parser
  (Maybe Text
   -> Maybe JsonDateTime
   -> Maybe CustomFieldDefinitionUser_access
   -> CustomFieldDefinition)
-> Parser (Maybe Text)
-> Parser
     (Maybe JsonDateTime
      -> Maybe CustomFieldDefinitionUser_access -> CustomFieldDefinition)
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
"tooltip")) Parser
  (Maybe JsonDateTime
   -> Maybe CustomFieldDefinitionUser_access -> CustomFieldDefinition)
-> Parser (Maybe JsonDateTime)
-> Parser
     (Maybe CustomFieldDefinitionUser_access -> CustomFieldDefinition)
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")) Parser
  (Maybe CustomFieldDefinitionUser_access -> CustomFieldDefinition)
-> Parser (Maybe CustomFieldDefinitionUser_access)
-> Parser CustomFieldDefinition
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 CustomFieldDefinitionUser_access)
forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Key
"user_access"))

-- | Create a new 'CustomFieldDefinition' with all required fields.
mkCustomFieldDefinition :: CustomFieldDefinition
mkCustomFieldDefinition :: CustomFieldDefinition
mkCustomFieldDefinition =
    CustomFieldDefinition
        { customFieldDefinitionCreated_at :: Maybe JsonDateTime
customFieldDefinitionCreated_at = Maybe JsonDateTime
forall a. Maybe a
GHC.Maybe.Nothing
        , customFieldDefinitionDeleted_at :: Maybe JsonDateTime
customFieldDefinitionDeleted_at = Maybe JsonDateTime
forall a. Maybe a
GHC.Maybe.Nothing
        , customFieldDefinitionDisplay_name :: Maybe Text
customFieldDefinitionDisplay_name = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
        , customFieldDefinitionId :: Maybe Text
customFieldDefinitionId = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
        , customFieldDefinitionName :: Maybe Text
customFieldDefinitionName = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
        , customFieldDefinitionObject :: Maybe Text
customFieldDefinitionObject = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
        , customFieldDefinitionRelated_type :: Maybe CustomFieldDefinitionRelated_type
customFieldDefinitionRelated_type = Maybe CustomFieldDefinitionRelated_type
forall a. Maybe a
GHC.Maybe.Nothing
        , customFieldDefinitionTooltip :: Maybe Text
customFieldDefinitionTooltip = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
        , customFieldDefinitionUpdated_at :: Maybe JsonDateTime
customFieldDefinitionUpdated_at = Maybe JsonDateTime
forall a. Maybe a
GHC.Maybe.Nothing
        , customFieldDefinitionUser_access :: Maybe CustomFieldDefinitionUser_access
customFieldDefinitionUser_access = Maybe CustomFieldDefinitionUser_access
forall a. Maybe a
GHC.Maybe.Nothing
        }

-- | Defines the enum schema located at @components.schemas.CustomFieldDefinition.properties.related_type@ in the specification.
data CustomFieldDefinitionRelated_type
    = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
      CustomFieldDefinitionRelated_typeOther Data.Aeson.Types.Internal.Value
    | -- | This constructor can be used to send values to the server which are not present in the specification yet.
      CustomFieldDefinitionRelated_typeTyped Data.Text.Internal.Text
    | -- | Represents the JSON value @"account"@
      CustomFieldDefinitionRelated_typeEnumAccount
    | -- | Represents the JSON value @"item"@
      CustomFieldDefinitionRelated_typeEnumItem
    | -- | Represents the JSON value @"plan"@
      CustomFieldDefinitionRelated_typeEnumPlan
    | -- | Represents the JSON value @"subscription"@
      CustomFieldDefinitionRelated_typeEnumSubscription
    | -- | Represents the JSON value @"charge"@
      CustomFieldDefinitionRelated_typeEnumCharge
    deriving (Int -> CustomFieldDefinitionRelated_type -> ShowS
[CustomFieldDefinitionRelated_type] -> ShowS
CustomFieldDefinitionRelated_type -> String
(Int -> CustomFieldDefinitionRelated_type -> ShowS)
-> (CustomFieldDefinitionRelated_type -> String)
-> ([CustomFieldDefinitionRelated_type] -> ShowS)
-> Show CustomFieldDefinitionRelated_type
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CustomFieldDefinitionRelated_type -> ShowS
showsPrec :: Int -> CustomFieldDefinitionRelated_type -> ShowS
$cshow :: CustomFieldDefinitionRelated_type -> String
show :: CustomFieldDefinitionRelated_type -> String
$cshowList :: [CustomFieldDefinitionRelated_type] -> ShowS
showList :: [CustomFieldDefinitionRelated_type] -> ShowS
GHC.Show.Show, CustomFieldDefinitionRelated_type
-> CustomFieldDefinitionRelated_type -> Bool
(CustomFieldDefinitionRelated_type
 -> CustomFieldDefinitionRelated_type -> Bool)
-> (CustomFieldDefinitionRelated_type
    -> CustomFieldDefinitionRelated_type -> Bool)
-> Eq CustomFieldDefinitionRelated_type
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CustomFieldDefinitionRelated_type
-> CustomFieldDefinitionRelated_type -> Bool
== :: CustomFieldDefinitionRelated_type
-> CustomFieldDefinitionRelated_type -> Bool
$c/= :: CustomFieldDefinitionRelated_type
-> CustomFieldDefinitionRelated_type -> Bool
/= :: CustomFieldDefinitionRelated_type
-> CustomFieldDefinitionRelated_type -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON CustomFieldDefinitionRelated_type where
    toJSON :: CustomFieldDefinitionRelated_type -> Value
toJSON (CustomFieldDefinitionRelated_typeOther Value
val) = Value
val
    toJSON (CustomFieldDefinitionRelated_typeTyped Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
    toJSON (CustomFieldDefinitionRelated_type
CustomFieldDefinitionRelated_typeEnumAccount) = Value
"account"
    toJSON (CustomFieldDefinitionRelated_type
CustomFieldDefinitionRelated_typeEnumItem) = Value
"item"
    toJSON (CustomFieldDefinitionRelated_type
CustomFieldDefinitionRelated_typeEnumPlan) = Value
"plan"
    toJSON (CustomFieldDefinitionRelated_type
CustomFieldDefinitionRelated_typeEnumSubscription) = Value
"subscription"
    toJSON (CustomFieldDefinitionRelated_type
CustomFieldDefinitionRelated_typeEnumCharge) = Value
"charge"
instance Data.Aeson.Types.FromJSON.FromJSON CustomFieldDefinitionRelated_type where
    parseJSON :: Value -> Parser CustomFieldDefinitionRelated_type
parseJSON Value
val =
        CustomFieldDefinitionRelated_type
-> Parser CustomFieldDefinitionRelated_type
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
"account" -> CustomFieldDefinitionRelated_type
CustomFieldDefinitionRelated_typeEnumAccount
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"item" -> CustomFieldDefinitionRelated_type
CustomFieldDefinitionRelated_typeEnumItem
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"plan" -> CustomFieldDefinitionRelated_type
CustomFieldDefinitionRelated_typeEnumPlan
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"subscription" -> CustomFieldDefinitionRelated_type
CustomFieldDefinitionRelated_typeEnumSubscription
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"charge" -> CustomFieldDefinitionRelated_type
CustomFieldDefinitionRelated_typeEnumCharge
                | Bool
GHC.Base.otherwise -> Value -> CustomFieldDefinitionRelated_type
CustomFieldDefinitionRelated_typeOther Value
val
            )

{- | Defines the enum schema located at @components.schemas.CustomFieldDefinition.properties.user_access@ in the specification.

The access control applied inside Recurly\'s admin UI:
- \`api_only\` - No one will be able to view or edit this field\'s data via the admin UI.
- \`read_only\` - Users with the Customers role will be able to view this field\'s data via the admin UI, but
  editing will only be available via the API.
- \`write\` - Users with the Customers role will be able to view and edit this field\'s data via the admin UI.
- \`set_only\` - Users with the Customers role will be able to set this field\'s data via the admin console.
-}
data CustomFieldDefinitionUser_access
    = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
      CustomFieldDefinitionUser_accessOther Data.Aeson.Types.Internal.Value
    | -- | This constructor can be used to send values to the server which are not present in the specification yet.
      CustomFieldDefinitionUser_accessTyped Data.Text.Internal.Text
    | -- | Represents the JSON value @"api_only"@
      CustomFieldDefinitionUser_accessEnumApi_only
    | -- | Represents the JSON value @"read_only"@
      CustomFieldDefinitionUser_accessEnumRead_only
    | -- | Represents the JSON value @"write"@
      CustomFieldDefinitionUser_accessEnumWrite
    | -- | Represents the JSON value @"set_only"@
      CustomFieldDefinitionUser_accessEnumSet_only
    deriving (Int -> CustomFieldDefinitionUser_access -> ShowS
[CustomFieldDefinitionUser_access] -> ShowS
CustomFieldDefinitionUser_access -> String
(Int -> CustomFieldDefinitionUser_access -> ShowS)
-> (CustomFieldDefinitionUser_access -> String)
-> ([CustomFieldDefinitionUser_access] -> ShowS)
-> Show CustomFieldDefinitionUser_access
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> CustomFieldDefinitionUser_access -> ShowS
showsPrec :: Int -> CustomFieldDefinitionUser_access -> ShowS
$cshow :: CustomFieldDefinitionUser_access -> String
show :: CustomFieldDefinitionUser_access -> String
$cshowList :: [CustomFieldDefinitionUser_access] -> ShowS
showList :: [CustomFieldDefinitionUser_access] -> ShowS
GHC.Show.Show, CustomFieldDefinitionUser_access
-> CustomFieldDefinitionUser_access -> Bool
(CustomFieldDefinitionUser_access
 -> CustomFieldDefinitionUser_access -> Bool)
-> (CustomFieldDefinitionUser_access
    -> CustomFieldDefinitionUser_access -> Bool)
-> Eq CustomFieldDefinitionUser_access
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CustomFieldDefinitionUser_access
-> CustomFieldDefinitionUser_access -> Bool
== :: CustomFieldDefinitionUser_access
-> CustomFieldDefinitionUser_access -> Bool
$c/= :: CustomFieldDefinitionUser_access
-> CustomFieldDefinitionUser_access -> Bool
/= :: CustomFieldDefinitionUser_access
-> CustomFieldDefinitionUser_access -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON CustomFieldDefinitionUser_access where
    toJSON :: CustomFieldDefinitionUser_access -> Value
toJSON (CustomFieldDefinitionUser_accessOther Value
val) = Value
val
    toJSON (CustomFieldDefinitionUser_accessTyped Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
    toJSON (CustomFieldDefinitionUser_access
CustomFieldDefinitionUser_accessEnumApi_only) = Value
"api_only"
    toJSON (CustomFieldDefinitionUser_access
CustomFieldDefinitionUser_accessEnumRead_only) = Value
"read_only"
    toJSON (CustomFieldDefinitionUser_access
CustomFieldDefinitionUser_accessEnumWrite) = Value
"write"
    toJSON (CustomFieldDefinitionUser_access
CustomFieldDefinitionUser_accessEnumSet_only) = Value
"set_only"
instance Data.Aeson.Types.FromJSON.FromJSON CustomFieldDefinitionUser_access where
    parseJSON :: Value -> Parser CustomFieldDefinitionUser_access
parseJSON Value
val =
        CustomFieldDefinitionUser_access
-> Parser CustomFieldDefinitionUser_access
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
"api_only" -> CustomFieldDefinitionUser_access
CustomFieldDefinitionUser_accessEnumApi_only
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"read_only" -> CustomFieldDefinitionUser_access
CustomFieldDefinitionUser_accessEnumRead_only
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"write" -> CustomFieldDefinitionUser_access
CustomFieldDefinitionUser_accessEnumWrite
                | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"set_only" -> CustomFieldDefinitionUser_access
CustomFieldDefinitionUser_accessEnumSet_only
                | Bool
GHC.Base.otherwise -> Value -> CustomFieldDefinitionUser_access
CustomFieldDefinitionUser_accessOther Value
val
            )