module Web.Scim.Schema.User.Address where
import Data.Aeson
import Data.Text hiding (dropWhile)
import GHC.Generics (Generic)
import Web.Scim.Schema.Common
data Address = Address
{ Address -> Maybe Text
formatted :: Maybe Text,
Address -> Maybe Text
streetAddress :: Maybe Text,
Address -> Maybe Text
locality :: Maybe Text,
Address -> Maybe Text
region :: Maybe Text,
Address -> Maybe Text
postalCode :: Maybe Text,
Address -> Maybe Text
country :: Maybe Text,
Address -> Maybe Text
typ :: Maybe Text,
Address -> Maybe ScimBool
primary :: Maybe ScimBool
}
deriving (Int -> Address -> ShowS
[Address] -> ShowS
Address -> String
(Int -> Address -> ShowS)
-> (Address -> String) -> ([Address] -> ShowS) -> Show Address
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Address -> ShowS
showsPrec :: Int -> Address -> ShowS
$cshow :: Address -> String
show :: Address -> String
$cshowList :: [Address] -> ShowS
showList :: [Address] -> ShowS
Show, Address -> Address -> Bool
(Address -> Address -> Bool)
-> (Address -> Address -> Bool) -> Eq Address
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Address -> Address -> Bool
== :: Address -> Address -> Bool
$c/= :: Address -> Address -> Bool
/= :: Address -> Address -> Bool
Eq, (forall x. Address -> Rep Address x)
-> (forall x. Rep Address x -> Address) -> Generic Address
forall x. Rep Address x -> Address
forall x. Address -> Rep Address x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Address -> Rep Address x
from :: forall x. Address -> Rep Address x
$cto :: forall x. Rep Address x -> Address
to :: forall x. Rep Address x -> Address
Generic)
instance FromJSON Address where
parseJSON :: Value -> Parser Address
parseJSON = ([Text] -> Parser Address)
-> (Value -> Parser Address)
-> Either [Text] Value
-> Parser Address
forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either (String -> Parser Address
forall a. String -> Parser a
forall (m :: * -> *) a. MonadFail m => String -> m a
fail (String -> Parser Address)
-> ([Text] -> String) -> [Text] -> Parser Address
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [Text] -> String
forall a. Show a => a -> String
show) (Options -> Value -> Parser Address
forall a.
(Generic a, GFromJSON Zero (Rep a)) =>
Options -> Value -> Parser a
genericParseJSON Options
parseOptions) (Either [Text] Value -> Parser Address)
-> (Value -> Either [Text] Value) -> Value -> Parser Address
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Value -> Either [Text] Value
forall (m :: * -> *). (m ~ Either [Text]) => Value -> m Value
jsonLower
instance ToJSON Address where
toJSON :: Address -> Value
toJSON = Options -> Address -> Value
forall a.
(Generic a, GToJSON' Value Zero (Rep a)) =>
Options -> a -> Value
genericToJSON Options
serializeOptions