{-# 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 Terminal_Reader
module StripeAPI.Types.Terminal_Reader 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.Char8
import qualified Data.ByteString.Char8 as Data.ByteString.Internal
import qualified Data.Functor
import qualified Data.Scientific
import qualified Data.Text
import qualified 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 StripeAPI.Common
import StripeAPI.TypeAlias
import {-# SOURCE #-} StripeAPI.Types.Terminal_Location
import qualified Prelude as GHC.Integer.Type
import qualified Prelude as GHC.Maybe

-- | Defines the object schema located at @components.schemas.terminal.reader@ in the specification.
--
-- A Reader represents a physical device for accepting payment details.
--
-- Related guide: [Connecting to a Reader](https:\/\/stripe.com\/docs\/terminal\/readers\/connecting).
data Terminal'reader = Terminal'reader
  { -- | device_sw_version: The current software version of the reader.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    Terminal'reader -> Maybe Text
terminal'readerDeviceSwVersion :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | device_type: Type of reader, one of \`bbpos_chipper2x\` or \`verifone_P400\`.
    Terminal'reader -> Terminal'readerDeviceType'
terminal'readerDeviceType :: Terminal'readerDeviceType',
    -- | id: Unique identifier for the object.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    Terminal'reader -> Text
terminal'readerId :: Data.Text.Internal.Text,
    -- | ip_address: The local IP address of the reader.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    Terminal'reader -> Maybe Text
terminal'readerIpAddress :: (GHC.Maybe.Maybe Data.Text.Internal.Text),
    -- | label: Custom label given to the reader for easier identification.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    Terminal'reader -> Text
terminal'readerLabel :: Data.Text.Internal.Text,
    -- | livemode: Has the value \`true\` if the object exists in live mode or the value \`false\` if the object exists in test mode.
    Terminal'reader -> Bool
terminal'readerLivemode :: GHC.Types.Bool,
    -- | location: The location identifier of the reader.
    Terminal'reader -> Maybe Terminal'readerLocation'Variants
terminal'readerLocation :: (GHC.Maybe.Maybe Terminal'readerLocation'Variants),
    -- | metadata: Set of [key-value pairs](https:\/\/stripe.com\/docs\/api\/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
    Terminal'reader -> Object
terminal'readerMetadata :: Data.Aeson.Types.Internal.Object,
    -- | serial_number: Serial number of the reader.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    Terminal'reader -> Text
terminal'readerSerialNumber :: Data.Text.Internal.Text,
    -- | status: The networking status of the reader.
    --
    -- Constraints:
    --
    -- * Maximum length of 5000
    Terminal'reader -> Maybe Text
terminal'readerStatus :: (GHC.Maybe.Maybe Data.Text.Internal.Text)
  }
  deriving
    ( Int -> Terminal'reader -> ShowS
[Terminal'reader] -> ShowS
Terminal'reader -> String
(Int -> Terminal'reader -> ShowS)
-> (Terminal'reader -> String)
-> ([Terminal'reader] -> ShowS)
-> Show Terminal'reader
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Terminal'reader] -> ShowS
$cshowList :: [Terminal'reader] -> ShowS
show :: Terminal'reader -> String
$cshow :: Terminal'reader -> String
showsPrec :: Int -> Terminal'reader -> ShowS
$cshowsPrec :: Int -> Terminal'reader -> ShowS
GHC.Show.Show,
      Terminal'reader -> Terminal'reader -> Bool
(Terminal'reader -> Terminal'reader -> Bool)
-> (Terminal'reader -> Terminal'reader -> Bool)
-> Eq Terminal'reader
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Terminal'reader -> Terminal'reader -> Bool
$c/= :: Terminal'reader -> Terminal'reader -> Bool
== :: Terminal'reader -> Terminal'reader -> Bool
$c== :: Terminal'reader -> Terminal'reader -> Bool
GHC.Classes.Eq
    )

instance Data.Aeson.Types.ToJSON.ToJSON Terminal'reader where
  toJSON :: Terminal'reader -> Value
toJSON Terminal'reader
obj = [Pair] -> Value
Data.Aeson.Types.Internal.object (Text
"device_sw_version" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Terminal'reader -> Maybe Text
terminal'readerDeviceSwVersion Terminal'reader
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"device_type" Text -> Terminal'readerDeviceType' -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Terminal'reader -> Terminal'readerDeviceType'
terminal'readerDeviceType Terminal'reader
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"id" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Terminal'reader -> Text
terminal'readerId Terminal'reader
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"ip_address" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Terminal'reader -> Maybe Text
terminal'readerIpAddress Terminal'reader
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"label" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Terminal'reader -> Text
terminal'readerLabel Terminal'reader
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"livemode" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Terminal'reader -> Bool
terminal'readerLivemode Terminal'reader
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"location" Text -> Maybe Terminal'readerLocation'Variants -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Terminal'reader -> Maybe Terminal'readerLocation'Variants
terminal'readerLocation Terminal'reader
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"metadata" Text -> Object -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Terminal'reader -> Object
terminal'readerMetadata Terminal'reader
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"serial_number" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Terminal'reader -> Text
terminal'readerSerialNumber Terminal'reader
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"status" Text -> Maybe Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Terminal'reader -> Maybe Text
terminal'readerStatus Terminal'reader
obj Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: Text
"object" Text -> Value -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Text -> Value
Data.Aeson.Types.Internal.String Text
"terminal.reader" Pair -> [Pair] -> [Pair]
forall a. a -> [a] -> [a]
: [Pair]
forall a. Monoid a => a
GHC.Base.mempty)
  toEncoding :: Terminal'reader -> Encoding
toEncoding Terminal'reader
obj = Series -> Encoding
Data.Aeson.Encoding.Internal.pairs ((Text
"device_sw_version" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Terminal'reader -> Maybe Text
terminal'readerDeviceSwVersion Terminal'reader
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"device_type" Text -> Terminal'readerDeviceType' -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Terminal'reader -> Terminal'readerDeviceType'
terminal'readerDeviceType Terminal'reader
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"id" Text -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Terminal'reader -> Text
terminal'readerId Terminal'reader
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"ip_address" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Terminal'reader -> Maybe Text
terminal'readerIpAddress Terminal'reader
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"label" Text -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Terminal'reader -> Text
terminal'readerLabel Terminal'reader
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"livemode" Text -> Bool -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Terminal'reader -> Bool
terminal'readerLivemode Terminal'reader
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"location" Text -> Maybe Terminal'readerLocation'Variants -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Terminal'reader -> Maybe Terminal'readerLocation'Variants
terminal'readerLocation Terminal'reader
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"metadata" Text -> Object -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Terminal'reader -> Object
terminal'readerMetadata Terminal'reader
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"serial_number" Text -> Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Terminal'reader -> Text
terminal'readerSerialNumber Terminal'reader
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> ((Text
"status" Text -> Maybe Text -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Terminal'reader -> Maybe Text
terminal'readerStatus Terminal'reader
obj) Series -> Series -> Series
forall a. Semigroup a => a -> a -> a
GHC.Base.<> (Text
"object" Text -> Value -> Series
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Data.Aeson.Types.ToJSON..= Text -> Value
Data.Aeson.Types.Internal.String Text
"terminal.reader")))))))))))

instance Data.Aeson.Types.FromJSON.FromJSON Terminal'reader where
  parseJSON :: Value -> Parser Terminal'reader
parseJSON = String
-> (Object -> Parser Terminal'reader)
-> Value
-> Parser Terminal'reader
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.Aeson.Types.FromJSON.withObject String
"Terminal'reader" (\Object
obj -> ((((((((((Maybe Text
 -> Terminal'readerDeviceType'
 -> Text
 -> Maybe Text
 -> Text
 -> Bool
 -> Maybe Terminal'readerLocation'Variants
 -> Object
 -> Text
 -> Maybe Text
 -> Terminal'reader)
-> Parser
     (Maybe Text
      -> Terminal'readerDeviceType'
      -> Text
      -> Maybe Text
      -> Text
      -> Bool
      -> Maybe Terminal'readerLocation'Variants
      -> Object
      -> Text
      -> Maybe Text
      -> Terminal'reader)
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Maybe Text
-> Terminal'readerDeviceType'
-> Text
-> Maybe Text
-> Text
-> Bool
-> Maybe Terminal'readerLocation'Variants
-> Object
-> Text
-> Maybe Text
-> Terminal'reader
Terminal'reader Parser
  (Maybe Text
   -> Terminal'readerDeviceType'
   -> Text
   -> Maybe Text
   -> Text
   -> Bool
   -> Maybe Terminal'readerLocation'Variants
   -> Object
   -> Text
   -> Maybe Text
   -> Terminal'reader)
-> Parser (Maybe Text)
-> Parser
     (Terminal'readerDeviceType'
      -> Text
      -> Maybe Text
      -> Text
      -> Bool
      -> Maybe Terminal'readerLocation'Variants
      -> Object
      -> Text
      -> Maybe Text
      -> Terminal'reader)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"device_sw_version")) Parser
  (Terminal'readerDeviceType'
   -> Text
   -> Maybe Text
   -> Text
   -> Bool
   -> Maybe Terminal'readerLocation'Variants
   -> Object
   -> Text
   -> Maybe Text
   -> Terminal'reader)
-> Parser Terminal'readerDeviceType'
-> Parser
     (Text
      -> Maybe Text
      -> Text
      -> Bool
      -> Maybe Terminal'readerLocation'Variants
      -> Object
      -> Text
      -> Maybe Text
      -> Terminal'reader)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser Terminal'readerDeviceType'
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"device_type")) Parser
  (Text
   -> Maybe Text
   -> Text
   -> Bool
   -> Maybe Terminal'readerLocation'Variants
   -> Object
   -> Text
   -> Maybe Text
   -> Terminal'reader)
-> Parser Text
-> Parser
     (Maybe Text
      -> Text
      -> Bool
      -> Maybe Terminal'readerLocation'Variants
      -> Object
      -> Text
      -> Maybe Text
      -> Terminal'reader)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"id")) Parser
  (Maybe Text
   -> Text
   -> Bool
   -> Maybe Terminal'readerLocation'Variants
   -> Object
   -> Text
   -> Maybe Text
   -> Terminal'reader)
-> Parser (Maybe Text)
-> Parser
     (Text
      -> Bool
      -> Maybe Terminal'readerLocation'Variants
      -> Object
      -> Text
      -> Maybe Text
      -> Terminal'reader)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"ip_address")) Parser
  (Text
   -> Bool
   -> Maybe Terminal'readerLocation'Variants
   -> Object
   -> Text
   -> Maybe Text
   -> Terminal'reader)
-> Parser Text
-> Parser
     (Bool
      -> Maybe Terminal'readerLocation'Variants
      -> Object
      -> Text
      -> Maybe Text
      -> Terminal'reader)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"label")) Parser
  (Bool
   -> Maybe Terminal'readerLocation'Variants
   -> Object
   -> Text
   -> Maybe Text
   -> Terminal'reader)
-> Parser Bool
-> Parser
     (Maybe Terminal'readerLocation'Variants
      -> Object -> Text -> Maybe Text -> Terminal'reader)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser Bool
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"livemode")) Parser
  (Maybe Terminal'readerLocation'Variants
   -> Object -> Text -> Maybe Text -> Terminal'reader)
-> Parser (Maybe Terminal'readerLocation'Variants)
-> Parser (Object -> Text -> Maybe Text -> Terminal'reader)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Terminal'readerLocation'Variants)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"location")) Parser (Object -> Text -> Maybe Text -> Terminal'reader)
-> Parser Object -> Parser (Text -> Maybe Text -> Terminal'reader)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser Object
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"metadata")) Parser (Text -> Maybe Text -> Terminal'reader)
-> Parser Text -> Parser (Maybe Text -> Terminal'reader)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Data.Aeson.Types.FromJSON..: Text
"serial_number")) Parser (Maybe Text -> Terminal'reader)
-> Parser (Maybe Text) -> Parser Terminal'reader
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
GHC.Base.<*> (Object
obj Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Data.Aeson.Types.FromJSON..:? Text
"status"))

-- | Create a new 'Terminal'reader' with all required fields.
mkTerminal'reader ::
  -- | 'terminal'readerDeviceType'
  Terminal'readerDeviceType' ->
  -- | 'terminal'readerId'
  Data.Text.Internal.Text ->
  -- | 'terminal'readerLabel'
  Data.Text.Internal.Text ->
  -- | 'terminal'readerLivemode'
  GHC.Types.Bool ->
  -- | 'terminal'readerMetadata'
  Data.Aeson.Types.Internal.Object ->
  -- | 'terminal'readerSerialNumber'
  Data.Text.Internal.Text ->
  Terminal'reader
mkTerminal'reader :: Terminal'readerDeviceType'
-> Text -> Text -> Bool -> Object -> Text -> Terminal'reader
mkTerminal'reader Terminal'readerDeviceType'
terminal'readerDeviceType Text
terminal'readerId Text
terminal'readerLabel Bool
terminal'readerLivemode Object
terminal'readerMetadata Text
terminal'readerSerialNumber =
  Terminal'reader :: Maybe Text
-> Terminal'readerDeviceType'
-> Text
-> Maybe Text
-> Text
-> Bool
-> Maybe Terminal'readerLocation'Variants
-> Object
-> Text
-> Maybe Text
-> Terminal'reader
Terminal'reader
    { terminal'readerDeviceSwVersion :: Maybe Text
terminal'readerDeviceSwVersion = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      terminal'readerDeviceType :: Terminal'readerDeviceType'
terminal'readerDeviceType = Terminal'readerDeviceType'
terminal'readerDeviceType,
      terminal'readerId :: Text
terminal'readerId = Text
terminal'readerId,
      terminal'readerIpAddress :: Maybe Text
terminal'readerIpAddress = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing,
      terminal'readerLabel :: Text
terminal'readerLabel = Text
terminal'readerLabel,
      terminal'readerLivemode :: Bool
terminal'readerLivemode = Bool
terminal'readerLivemode,
      terminal'readerLocation :: Maybe Terminal'readerLocation'Variants
terminal'readerLocation = Maybe Terminal'readerLocation'Variants
forall a. Maybe a
GHC.Maybe.Nothing,
      terminal'readerMetadata :: Object
terminal'readerMetadata = Object
terminal'readerMetadata,
      terminal'readerSerialNumber :: Text
terminal'readerSerialNumber = Text
terminal'readerSerialNumber,
      terminal'readerStatus :: Maybe Text
terminal'readerStatus = Maybe Text
forall a. Maybe a
GHC.Maybe.Nothing
    }

-- | Defines the enum schema located at @components.schemas.terminal.reader.properties.device_type@ in the specification.
--
-- Type of reader, one of \`bbpos_chipper2x\` or \`verifone_P400\`.
data Terminal'readerDeviceType'
  = -- | This case is used if the value encountered during decoding does not match any of the provided cases in the specification.
    Terminal'readerDeviceType'Other Data.Aeson.Types.Internal.Value
  | -- | This constructor can be used to send values to the server which are not present in the specification yet.
    Terminal'readerDeviceType'Typed Data.Text.Internal.Text
  | -- | Represents the JSON value @"bbpos_chipper2x"@
    Terminal'readerDeviceType'EnumBbposChipper2x
  | -- | Represents the JSON value @"verifone_P400"@
    Terminal'readerDeviceType'EnumVerifoneP400
  deriving (Int -> Terminal'readerDeviceType' -> ShowS
[Terminal'readerDeviceType'] -> ShowS
Terminal'readerDeviceType' -> String
(Int -> Terminal'readerDeviceType' -> ShowS)
-> (Terminal'readerDeviceType' -> String)
-> ([Terminal'readerDeviceType'] -> ShowS)
-> Show Terminal'readerDeviceType'
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Terminal'readerDeviceType'] -> ShowS
$cshowList :: [Terminal'readerDeviceType'] -> ShowS
show :: Terminal'readerDeviceType' -> String
$cshow :: Terminal'readerDeviceType' -> String
showsPrec :: Int -> Terminal'readerDeviceType' -> ShowS
$cshowsPrec :: Int -> Terminal'readerDeviceType' -> ShowS
GHC.Show.Show, Terminal'readerDeviceType' -> Terminal'readerDeviceType' -> Bool
(Terminal'readerDeviceType' -> Terminal'readerDeviceType' -> Bool)
-> (Terminal'readerDeviceType'
    -> Terminal'readerDeviceType' -> Bool)
-> Eq Terminal'readerDeviceType'
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Terminal'readerDeviceType' -> Terminal'readerDeviceType' -> Bool
$c/= :: Terminal'readerDeviceType' -> Terminal'readerDeviceType' -> Bool
== :: Terminal'readerDeviceType' -> Terminal'readerDeviceType' -> Bool
$c== :: Terminal'readerDeviceType' -> Terminal'readerDeviceType' -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON Terminal'readerDeviceType' where
  toJSON :: Terminal'readerDeviceType' -> Value
toJSON (Terminal'readerDeviceType'Other Value
val) = Value
val
  toJSON (Terminal'readerDeviceType'Typed Text
val) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
val
  toJSON (Terminal'readerDeviceType'
Terminal'readerDeviceType'EnumBbposChipper2x) = Value
"bbpos_chipper2x"
  toJSON (Terminal'readerDeviceType'
Terminal'readerDeviceType'EnumVerifoneP400) = Value
"verifone_P400"

instance Data.Aeson.Types.FromJSON.FromJSON Terminal'readerDeviceType' where
  parseJSON :: Value -> Parser Terminal'readerDeviceType'
parseJSON Value
val =
    Terminal'readerDeviceType' -> Parser Terminal'readerDeviceType'
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
"bbpos_chipper2x" -> Terminal'readerDeviceType'
Terminal'readerDeviceType'EnumBbposChipper2x
            | Value
val Value -> Value -> Bool
forall a. Eq a => a -> a -> Bool
GHC.Classes.== Value
"verifone_P400" -> Terminal'readerDeviceType'
Terminal'readerDeviceType'EnumVerifoneP400
            | Bool
GHC.Base.otherwise -> Value -> Terminal'readerDeviceType'
Terminal'readerDeviceType'Other Value
val
      )

-- | Defines the oneOf schema located at @components.schemas.terminal.reader.properties.location.anyOf@ in the specification.
--
-- The location identifier of the reader.
data Terminal'readerLocation'Variants
  = Terminal'readerLocation'Text Data.Text.Internal.Text
  | Terminal'readerLocation'Terminal'location Terminal'location
  deriving (Int -> Terminal'readerLocation'Variants -> ShowS
[Terminal'readerLocation'Variants] -> ShowS
Terminal'readerLocation'Variants -> String
(Int -> Terminal'readerLocation'Variants -> ShowS)
-> (Terminal'readerLocation'Variants -> String)
-> ([Terminal'readerLocation'Variants] -> ShowS)
-> Show Terminal'readerLocation'Variants
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Terminal'readerLocation'Variants] -> ShowS
$cshowList :: [Terminal'readerLocation'Variants] -> ShowS
show :: Terminal'readerLocation'Variants -> String
$cshow :: Terminal'readerLocation'Variants -> String
showsPrec :: Int -> Terminal'readerLocation'Variants -> ShowS
$cshowsPrec :: Int -> Terminal'readerLocation'Variants -> ShowS
GHC.Show.Show, Terminal'readerLocation'Variants
-> Terminal'readerLocation'Variants -> Bool
(Terminal'readerLocation'Variants
 -> Terminal'readerLocation'Variants -> Bool)
-> (Terminal'readerLocation'Variants
    -> Terminal'readerLocation'Variants -> Bool)
-> Eq Terminal'readerLocation'Variants
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Terminal'readerLocation'Variants
-> Terminal'readerLocation'Variants -> Bool
$c/= :: Terminal'readerLocation'Variants
-> Terminal'readerLocation'Variants -> Bool
== :: Terminal'readerLocation'Variants
-> Terminal'readerLocation'Variants -> Bool
$c== :: Terminal'readerLocation'Variants
-> Terminal'readerLocation'Variants -> Bool
GHC.Classes.Eq)

instance Data.Aeson.Types.ToJSON.ToJSON Terminal'readerLocation'Variants where
  toJSON :: Terminal'readerLocation'Variants -> Value
toJSON (Terminal'readerLocation'Text Text
a) = Text -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Text
a
  toJSON (Terminal'readerLocation'Terminal'location Terminal'location
a) = Terminal'location -> Value
forall a. ToJSON a => a -> Value
Data.Aeson.Types.ToJSON.toJSON Terminal'location
a

instance Data.Aeson.Types.FromJSON.FromJSON Terminal'readerLocation'Variants where
  parseJSON :: Value -> Parser Terminal'readerLocation'Variants
parseJSON Value
val = case (Text -> Terminal'readerLocation'Variants
Terminal'readerLocation'Text (Text -> Terminal'readerLocation'Variants)
-> Result Text -> Result Terminal'readerLocation'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result Text
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result Terminal'readerLocation'Variants
-> Result Terminal'readerLocation'Variants
-> Result Terminal'readerLocation'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> ((Terminal'location -> Terminal'readerLocation'Variants
Terminal'readerLocation'Terminal'location (Terminal'location -> Terminal'readerLocation'Variants)
-> Result Terminal'location
-> Result Terminal'readerLocation'Variants
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Data.Functor.<$> Value -> Result Terminal'location
forall a. FromJSON a => Value -> Result a
Data.Aeson.Types.FromJSON.fromJSON Value
val) Result Terminal'readerLocation'Variants
-> Result Terminal'readerLocation'Variants
-> Result Terminal'readerLocation'Variants
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
GHC.Base.<|> String -> Result Terminal'readerLocation'Variants
forall a. String -> Result a
Data.Aeson.Types.Internal.Error String
"No variant matched") of
    Data.Aeson.Types.Internal.Success Terminal'readerLocation'Variants
a -> Terminal'readerLocation'Variants
-> Parser Terminal'readerLocation'Variants
forall (f :: * -> *) a. Applicative f => a -> f a
GHC.Base.pure Terminal'readerLocation'Variants
a
    Data.Aeson.Types.Internal.Error String
a -> String -> Parser Terminal'readerLocation'Variants
forall (m :: * -> *) a. MonadFail m => String -> m a
Control.Monad.Fail.fail String
a