module Wire.API.User.Auth.LegalHold where
import Data.Aeson (FromJSON (..), ToJSON (..))
import Data.Aeson qualified as A
import Data.Id
import Data.Misc
import Data.OpenApi qualified as S
import Data.Schema
import Imports
import Wire.API.User.Auth
data LegalHoldLogin = LegalHoldLogin
{ LegalHoldLogin -> UserId
lhlUserId :: !UserId,
LegalHoldLogin -> Maybe PlainTextPassword6
lhlPassword :: !(Maybe PlainTextPassword6),
LegalHoldLogin -> Maybe CookieLabel
lhlLabel :: !(Maybe CookieLabel)
}
deriving (Value -> Parser [LegalHoldLogin]
Value -> Parser LegalHoldLogin
(Value -> Parser LegalHoldLogin)
-> (Value -> Parser [LegalHoldLogin]) -> FromJSON LegalHoldLogin
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
$cparseJSON :: Value -> Parser LegalHoldLogin
parseJSON :: Value -> Parser LegalHoldLogin
$cparseJSONList :: Value -> Parser [LegalHoldLogin]
parseJSONList :: Value -> Parser [LegalHoldLogin]
FromJSON, [LegalHoldLogin] -> Value
[LegalHoldLogin] -> Encoding
LegalHoldLogin -> Value
LegalHoldLogin -> Encoding
(LegalHoldLogin -> Value)
-> (LegalHoldLogin -> Encoding)
-> ([LegalHoldLogin] -> Value)
-> ([LegalHoldLogin] -> Encoding)
-> ToJSON LegalHoldLogin
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
$ctoJSON :: LegalHoldLogin -> Value
toJSON :: LegalHoldLogin -> Value
$ctoEncoding :: LegalHoldLogin -> Encoding
toEncoding :: LegalHoldLogin -> Encoding
$ctoJSONList :: [LegalHoldLogin] -> Value
toJSONList :: [LegalHoldLogin] -> Value
$ctoEncodingList :: [LegalHoldLogin] -> Encoding
toEncodingList :: [LegalHoldLogin] -> Encoding
ToJSON, Typeable LegalHoldLogin
Typeable LegalHoldLogin =>
(Proxy LegalHoldLogin -> Declare (Definitions Schema) NamedSchema)
-> ToSchema LegalHoldLogin
Proxy LegalHoldLogin -> Declare (Definitions Schema) NamedSchema
forall a.
Typeable a =>
(Proxy a -> Declare (Definitions Schema) NamedSchema) -> ToSchema a
$cdeclareNamedSchema :: Proxy LegalHoldLogin -> Declare (Definitions Schema) NamedSchema
declareNamedSchema :: Proxy LegalHoldLogin -> Declare (Definitions Schema) NamedSchema
S.ToSchema) via Schema LegalHoldLogin
instance ToSchema LegalHoldLogin where
schema :: ValueSchema NamedSwaggerDoc LegalHoldLogin
schema =
Text
-> SchemaP SwaggerDoc Object [Pair] LegalHoldLogin LegalHoldLogin
-> ValueSchema NamedSwaggerDoc LegalHoldLogin
forall doc doc' a b.
HasObject doc doc' =>
Text
-> SchemaP doc Object [Pair] a b -> SchemaP doc' Value Value a b
object Text
"LegalHoldLogin" (SchemaP SwaggerDoc Object [Pair] LegalHoldLogin LegalHoldLogin
-> ValueSchema NamedSwaggerDoc LegalHoldLogin)
-> SchemaP SwaggerDoc Object [Pair] LegalHoldLogin LegalHoldLogin
-> ValueSchema NamedSwaggerDoc LegalHoldLogin
forall a b. (a -> b) -> a -> b
$
UserId
-> Maybe PlainTextPassword6 -> Maybe CookieLabel -> LegalHoldLogin
LegalHoldLogin
(UserId
-> Maybe PlainTextPassword6 -> Maybe CookieLabel -> LegalHoldLogin)
-> SchemaP SwaggerDoc Object [Pair] LegalHoldLogin UserId
-> SchemaP
SwaggerDoc
Object
[Pair]
LegalHoldLogin
(Maybe PlainTextPassword6 -> Maybe CookieLabel -> LegalHoldLogin)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> LegalHoldLogin -> UserId
lhlUserId (LegalHoldLogin -> UserId)
-> SchemaP SwaggerDoc Object [Pair] UserId UserId
-> SchemaP SwaggerDoc Object [Pair] LegalHoldLogin UserId
forall (p :: * -> * -> *) a a' b.
Profunctor p =>
(a -> a') -> p a' b -> p a b
.= Text
-> SchemaP NamedSwaggerDoc Value Value UserId UserId
-> SchemaP SwaggerDoc Object [Pair] UserId UserId
forall doc' doc a b.
HasField doc' doc =>
Text
-> SchemaP doc' Value Value a b -> SchemaP doc Object [Pair] a b
field Text
"user" SchemaP NamedSwaggerDoc Value Value UserId UserId
forall a. ToSchema a => ValueSchema NamedSwaggerDoc a
schema
SchemaP
SwaggerDoc
Object
[Pair]
LegalHoldLogin
(Maybe PlainTextPassword6 -> Maybe CookieLabel -> LegalHoldLogin)
-> SchemaP
SwaggerDoc Object [Pair] LegalHoldLogin (Maybe PlainTextPassword6)
-> SchemaP
SwaggerDoc
Object
[Pair]
LegalHoldLogin
(Maybe CookieLabel -> LegalHoldLogin)
forall a b.
SchemaP SwaggerDoc Object [Pair] LegalHoldLogin (a -> b)
-> SchemaP SwaggerDoc Object [Pair] LegalHoldLogin a
-> SchemaP SwaggerDoc Object [Pair] LegalHoldLogin b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> LegalHoldLogin -> Maybe PlainTextPassword6
lhlPassword (LegalHoldLogin -> Maybe PlainTextPassword6)
-> SchemaP
SwaggerDoc
Object
[Pair]
(Maybe PlainTextPassword6)
(Maybe PlainTextPassword6)
-> SchemaP
SwaggerDoc Object [Pair] LegalHoldLogin (Maybe PlainTextPassword6)
forall (p :: * -> * -> *) a a' b.
Profunctor p =>
(a -> a') -> p a' b -> p a b
.= Text
-> SchemaP
NamedSwaggerDoc
Value
Value
(Maybe PlainTextPassword6)
PlainTextPassword6
-> SchemaP
SwaggerDoc
Object
[Pair]
(Maybe PlainTextPassword6)
(Maybe PlainTextPassword6)
forall doc doc' a b.
(HasOpt doc, HasField doc' doc) =>
Text
-> SchemaP doc' Value Value a b
-> SchemaP doc Object [Pair] a (Maybe b)
optField Text
"password" (Value
-> SchemaP
NamedSwaggerDoc Value Value PlainTextPassword6 PlainTextPassword6
-> SchemaP
NamedSwaggerDoc
Value
Value
(Maybe PlainTextPassword6)
PlainTextPassword6
forall w d v a b.
w -> SchemaP d v w a b -> SchemaP d v w (Maybe a) b
maybeWithDefault Value
A.Null SchemaP
NamedSwaggerDoc Value Value PlainTextPassword6 PlainTextPassword6
forall a. ToSchema a => ValueSchema NamedSwaggerDoc a
schema)
SchemaP
SwaggerDoc
Object
[Pair]
LegalHoldLogin
(Maybe CookieLabel -> LegalHoldLogin)
-> SchemaP
SwaggerDoc Object [Pair] LegalHoldLogin (Maybe CookieLabel)
-> SchemaP SwaggerDoc Object [Pair] LegalHoldLogin LegalHoldLogin
forall a b.
SchemaP SwaggerDoc Object [Pair] LegalHoldLogin (a -> b)
-> SchemaP SwaggerDoc Object [Pair] LegalHoldLogin a
-> SchemaP SwaggerDoc Object [Pair] LegalHoldLogin b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> LegalHoldLogin -> Maybe CookieLabel
lhlLabel (LegalHoldLogin -> Maybe CookieLabel)
-> SchemaP
SwaggerDoc Object [Pair] (Maybe CookieLabel) (Maybe CookieLabel)
-> SchemaP
SwaggerDoc Object [Pair] LegalHoldLogin (Maybe CookieLabel)
forall (p :: * -> * -> *) a a' b.
Profunctor p =>
(a -> a') -> p a' b -> p a b
.= Text
-> SchemaP
NamedSwaggerDoc Value Value (Maybe CookieLabel) CookieLabel
-> SchemaP
SwaggerDoc Object [Pair] (Maybe CookieLabel) (Maybe CookieLabel)
forall doc doc' a b.
(HasOpt doc, HasField doc' doc) =>
Text
-> SchemaP doc' Value Value a b
-> SchemaP doc Object [Pair] a (Maybe b)
optField Text
"label" (Value
-> SchemaP NamedSwaggerDoc Value Value CookieLabel CookieLabel
-> SchemaP
NamedSwaggerDoc Value Value (Maybe CookieLabel) CookieLabel
forall w d v a b.
w -> SchemaP d v w a b -> SchemaP d v w (Maybe a) b
maybeWithDefault Value
A.Null SchemaP NamedSwaggerDoc Value Value CookieLabel CookieLabel
forall a. ToSchema a => ValueSchema NamedSwaggerDoc a
schema)