{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-}

-- This file is part of the Wire Server implementation.
--
-- Copyright (C) 2022 Wire Swiss GmbH <opensource@wire.com>
--
-- This program is free software: you can redistribute it and/or modify it under
-- the terms of the GNU Affero General Public License as published by the Free
-- Software Foundation, either version 3 of the License, or (at your option) any
-- later version.
--
-- This program is distributed in the hope that it will be useful, but WITHOUT
-- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-- FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
-- details.
--
-- You should have received a copy of the GNU Affero General Public License along
-- with this program. If not, see <https://www.gnu.org/licenses/>.

module Wire.API.Provider.Bot
  ( -- * Bot Views
    BotConvView,
    botConvView,
    botConvId,
    botConvName,
    botConvMembers,
    BotUserView (..),
  )
where

import Control.Lens (makeLenses)
import Data.Aeson qualified as A
import Data.Handle (Handle)
import Data.Id
import Data.OpenApi qualified as S
import Data.Schema
import Imports
import Wire.API.Conversation.Member (OtherMember (..))
import Wire.API.User.Profile (ColourId, Name)
import Wire.Arbitrary (Arbitrary, GenericUniform (..))

--------------------------------------------------------------------------------
-- BotConvView

-- | A conversation as seen by a bot.
data BotConvView = BotConvView
  { BotConvView -> ConvId
_botConvId :: ConvId,
    BotConvView -> Maybe Text
_botConvName :: Maybe Text,
    BotConvView -> [OtherMember]
_botConvMembers :: [OtherMember]
  }
  deriving stock (BotConvView -> BotConvView -> Bool
(BotConvView -> BotConvView -> Bool)
-> (BotConvView -> BotConvView -> Bool) -> Eq BotConvView
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: BotConvView -> BotConvView -> Bool
== :: BotConvView -> BotConvView -> Bool
$c/= :: BotConvView -> BotConvView -> Bool
/= :: BotConvView -> BotConvView -> Bool
Eq, Int -> BotConvView -> ShowS
[BotConvView] -> ShowS
BotConvView -> String
(Int -> BotConvView -> ShowS)
-> (BotConvView -> String)
-> ([BotConvView] -> ShowS)
-> Show BotConvView
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> BotConvView -> ShowS
showsPrec :: Int -> BotConvView -> ShowS
$cshow :: BotConvView -> String
show :: BotConvView -> String
$cshowList :: [BotConvView] -> ShowS
showList :: [BotConvView] -> ShowS
Show, (forall x. BotConvView -> Rep BotConvView x)
-> (forall x. Rep BotConvView x -> BotConvView)
-> Generic BotConvView
forall x. Rep BotConvView x -> BotConvView
forall x. BotConvView -> Rep BotConvView x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. BotConvView -> Rep BotConvView x
from :: forall x. BotConvView -> Rep BotConvView x
$cto :: forall x. Rep BotConvView x -> BotConvView
to :: forall x. Rep BotConvView x -> BotConvView
Generic)
  deriving (Gen BotConvView
Gen BotConvView
-> (BotConvView -> [BotConvView]) -> Arbitrary BotConvView
BotConvView -> [BotConvView]
forall a. Gen a -> (a -> [a]) -> Arbitrary a
$carbitrary :: Gen BotConvView
arbitrary :: Gen BotConvView
$cshrink :: BotConvView -> [BotConvView]
shrink :: BotConvView -> [BotConvView]
Arbitrary) via (GenericUniform BotConvView)
  deriving ([BotConvView] -> Value
[BotConvView] -> Encoding
BotConvView -> Value
BotConvView -> Encoding
(BotConvView -> Value)
-> (BotConvView -> Encoding)
-> ([BotConvView] -> Value)
-> ([BotConvView] -> Encoding)
-> ToJSON BotConvView
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
$ctoJSON :: BotConvView -> Value
toJSON :: BotConvView -> Value
$ctoEncoding :: BotConvView -> Encoding
toEncoding :: BotConvView -> Encoding
$ctoJSONList :: [BotConvView] -> Value
toJSONList :: [BotConvView] -> Value
$ctoEncodingList :: [BotConvView] -> Encoding
toEncodingList :: [BotConvView] -> Encoding
A.ToJSON, Value -> Parser [BotConvView]
Value -> Parser BotConvView
(Value -> Parser BotConvView)
-> (Value -> Parser [BotConvView]) -> FromJSON BotConvView
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
$cparseJSON :: Value -> Parser BotConvView
parseJSON :: Value -> Parser BotConvView
$cparseJSONList :: Value -> Parser [BotConvView]
parseJSONList :: Value -> Parser [BotConvView]
A.FromJSON, Typeable BotConvView
Typeable BotConvView =>
(Proxy BotConvView -> Declare (Definitions Schema) NamedSchema)
-> ToSchema BotConvView
Proxy BotConvView -> Declare (Definitions Schema) NamedSchema
forall a.
Typeable a =>
(Proxy a -> Declare (Definitions Schema) NamedSchema) -> ToSchema a
$cdeclareNamedSchema :: Proxy BotConvView -> Declare (Definitions Schema) NamedSchema
declareNamedSchema :: Proxy BotConvView -> Declare (Definitions Schema) NamedSchema
S.ToSchema) via Schema BotConvView

instance ToSchema BotConvView where
  schema :: ValueSchema NamedSwaggerDoc BotConvView
schema =
    Text
-> SchemaP SwaggerDoc Object [Pair] BotConvView BotConvView
-> ValueSchema NamedSwaggerDoc BotConvView
forall doc doc' a b.
HasObject doc doc' =>
Text
-> SchemaP doc Object [Pair] a b -> SchemaP doc' Value Value a b
object Text
"BotConvView" (SchemaP SwaggerDoc Object [Pair] BotConvView BotConvView
 -> ValueSchema NamedSwaggerDoc BotConvView)
-> SchemaP SwaggerDoc Object [Pair] BotConvView BotConvView
-> ValueSchema NamedSwaggerDoc BotConvView
forall a b. (a -> b) -> a -> b
$
      ConvId -> Maybe Text -> [OtherMember] -> BotConvView
BotConvView
        (ConvId -> Maybe Text -> [OtherMember] -> BotConvView)
-> SchemaP SwaggerDoc Object [Pair] BotConvView ConvId
-> SchemaP
     SwaggerDoc
     Object
     [Pair]
     BotConvView
     (Maybe Text -> [OtherMember] -> BotConvView)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> BotConvView -> ConvId
_botConvId (BotConvView -> ConvId)
-> SchemaP SwaggerDoc Object [Pair] ConvId ConvId
-> SchemaP SwaggerDoc Object [Pair] BotConvView ConvId
forall (p :: * -> * -> *) a a' b.
Profunctor p =>
(a -> a') -> p a' b -> p a b
.= Text
-> SchemaP NamedSwaggerDoc Value Value ConvId ConvId
-> SchemaP SwaggerDoc Object [Pair] ConvId ConvId
forall doc' doc a b.
HasField doc' doc =>
Text
-> SchemaP doc' Value Value a b -> SchemaP doc Object [Pair] a b
field Text
"id" SchemaP NamedSwaggerDoc Value Value ConvId ConvId
forall a. ToSchema a => ValueSchema NamedSwaggerDoc a
schema
        SchemaP
  SwaggerDoc
  Object
  [Pair]
  BotConvView
  (Maybe Text -> [OtherMember] -> BotConvView)
-> SchemaP SwaggerDoc Object [Pair] BotConvView (Maybe Text)
-> SchemaP
     SwaggerDoc Object [Pair] BotConvView ([OtherMember] -> BotConvView)
forall a b.
SchemaP SwaggerDoc Object [Pair] BotConvView (a -> b)
-> SchemaP SwaggerDoc Object [Pair] BotConvView a
-> SchemaP SwaggerDoc Object [Pair] BotConvView b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> BotConvView -> Maybe Text
_botConvName (BotConvView -> Maybe Text)
-> SchemaP SwaggerDoc Object [Pair] (Maybe Text) (Maybe Text)
-> SchemaP SwaggerDoc Object [Pair] BotConvView (Maybe Text)
forall (p :: * -> * -> *) a a' b.
Profunctor p =>
(a -> a') -> p a' b -> p a b
.= SchemaP SwaggerDoc Object [Pair] Text (Maybe Text)
-> SchemaP SwaggerDoc Object [Pair] (Maybe Text) (Maybe Text)
forall w d v a b.
Monoid w =>
SchemaP d v w a b -> SchemaP d v w (Maybe a) b
maybe_ (Text
-> SchemaP NamedSwaggerDoc Value Value Text Text
-> SchemaP SwaggerDoc Object [Pair] Text (Maybe Text)
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
"name" SchemaP NamedSwaggerDoc Value Value Text Text
forall a. ToSchema a => ValueSchema NamedSwaggerDoc a
schema)
        SchemaP
  SwaggerDoc Object [Pair] BotConvView ([OtherMember] -> BotConvView)
-> SchemaP SwaggerDoc Object [Pair] BotConvView [OtherMember]
-> SchemaP SwaggerDoc Object [Pair] BotConvView BotConvView
forall a b.
SchemaP SwaggerDoc Object [Pair] BotConvView (a -> b)
-> SchemaP SwaggerDoc Object [Pair] BotConvView a
-> SchemaP SwaggerDoc Object [Pair] BotConvView b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> BotConvView -> [OtherMember]
_botConvMembers (BotConvView -> [OtherMember])
-> SchemaP SwaggerDoc Object [Pair] [OtherMember] [OtherMember]
-> SchemaP SwaggerDoc Object [Pair] BotConvView [OtherMember]
forall (p :: * -> * -> *) a a' b.
Profunctor p =>
(a -> a') -> p a' b -> p a b
.= Text
-> SchemaP SwaggerDoc Value Value [OtherMember] [OtherMember]
-> SchemaP SwaggerDoc Object [Pair] [OtherMember] [OtherMember]
forall doc' doc a b.
HasField doc' doc =>
Text
-> SchemaP doc' Value Value a b -> SchemaP doc Object [Pair] a b
field Text
"members" (ValueSchema NamedSwaggerDoc OtherMember
-> SchemaP SwaggerDoc Value Value [OtherMember] [OtherMember]
forall ndoc doc a.
(HasArray ndoc doc, HasName ndoc) =>
ValueSchema ndoc a -> ValueSchema doc [a]
array ValueSchema NamedSwaggerDoc OtherMember
forall a. ToSchema a => ValueSchema NamedSwaggerDoc a
schema)

botConvView :: ConvId -> Maybe Text -> [OtherMember] -> BotConvView
botConvView :: ConvId -> Maybe Text -> [OtherMember] -> BotConvView
botConvView = ConvId -> Maybe Text -> [OtherMember] -> BotConvView
BotConvView

--------------------------------------------------------------------------------
-- BotUserView

data BotUserView = BotUserView
  { BotUserView -> UserId
botUserViewId :: UserId,
    BotUserView -> Name
botUserViewName :: Name,
    BotUserView -> ColourId
botUserViewColour :: ColourId,
    BotUserView -> Maybe Handle
botUserViewHandle :: Maybe Handle,
    BotUserView -> Maybe TeamId
botUserViewTeam :: Maybe TeamId
  }
  deriving stock (BotUserView -> BotUserView -> Bool
(BotUserView -> BotUserView -> Bool)
-> (BotUserView -> BotUserView -> Bool) -> Eq BotUserView
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: BotUserView -> BotUserView -> Bool
== :: BotUserView -> BotUserView -> Bool
$c/= :: BotUserView -> BotUserView -> Bool
/= :: BotUserView -> BotUserView -> Bool
Eq, Int -> BotUserView -> ShowS
[BotUserView] -> ShowS
BotUserView -> String
(Int -> BotUserView -> ShowS)
-> (BotUserView -> String)
-> ([BotUserView] -> ShowS)
-> Show BotUserView
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> BotUserView -> ShowS
showsPrec :: Int -> BotUserView -> ShowS
$cshow :: BotUserView -> String
show :: BotUserView -> String
$cshowList :: [BotUserView] -> ShowS
showList :: [BotUserView] -> ShowS
Show, (forall x. BotUserView -> Rep BotUserView x)
-> (forall x. Rep BotUserView x -> BotUserView)
-> Generic BotUserView
forall x. Rep BotUserView x -> BotUserView
forall x. BotUserView -> Rep BotUserView x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. BotUserView -> Rep BotUserView x
from :: forall x. BotUserView -> Rep BotUserView x
$cto :: forall x. Rep BotUserView x -> BotUserView
to :: forall x. Rep BotUserView x -> BotUserView
Generic)
  deriving (Gen BotUserView
Gen BotUserView
-> (BotUserView -> [BotUserView]) -> Arbitrary BotUserView
BotUserView -> [BotUserView]
forall a. Gen a -> (a -> [a]) -> Arbitrary a
$carbitrary :: Gen BotUserView
arbitrary :: Gen BotUserView
$cshrink :: BotUserView -> [BotUserView]
shrink :: BotUserView -> [BotUserView]
Arbitrary) via (GenericUniform BotUserView)
  deriving ([BotUserView] -> Value
[BotUserView] -> Encoding
BotUserView -> Value
BotUserView -> Encoding
(BotUserView -> Value)
-> (BotUserView -> Encoding)
-> ([BotUserView] -> Value)
-> ([BotUserView] -> Encoding)
-> ToJSON BotUserView
forall a.
(a -> Value)
-> (a -> Encoding)
-> ([a] -> Value)
-> ([a] -> Encoding)
-> ToJSON a
$ctoJSON :: BotUserView -> Value
toJSON :: BotUserView -> Value
$ctoEncoding :: BotUserView -> Encoding
toEncoding :: BotUserView -> Encoding
$ctoJSONList :: [BotUserView] -> Value
toJSONList :: [BotUserView] -> Value
$ctoEncodingList :: [BotUserView] -> Encoding
toEncodingList :: [BotUserView] -> Encoding
A.ToJSON, Value -> Parser [BotUserView]
Value -> Parser BotUserView
(Value -> Parser BotUserView)
-> (Value -> Parser [BotUserView]) -> FromJSON BotUserView
forall a.
(Value -> Parser a) -> (Value -> Parser [a]) -> FromJSON a
$cparseJSON :: Value -> Parser BotUserView
parseJSON :: Value -> Parser BotUserView
$cparseJSONList :: Value -> Parser [BotUserView]
parseJSONList :: Value -> Parser [BotUserView]
A.FromJSON, Typeable BotUserView
Typeable BotUserView =>
(Proxy BotUserView -> Declare (Definitions Schema) NamedSchema)
-> ToSchema BotUserView
Proxy BotUserView -> Declare (Definitions Schema) NamedSchema
forall a.
Typeable a =>
(Proxy a -> Declare (Definitions Schema) NamedSchema) -> ToSchema a
$cdeclareNamedSchema :: Proxy BotUserView -> Declare (Definitions Schema) NamedSchema
declareNamedSchema :: Proxy BotUserView -> Declare (Definitions Schema) NamedSchema
S.ToSchema) via Schema BotUserView

instance ToSchema BotUserView where
  schema :: ValueSchema NamedSwaggerDoc BotUserView
schema =
    Text
-> SchemaP SwaggerDoc Object [Pair] BotUserView BotUserView
-> ValueSchema NamedSwaggerDoc BotUserView
forall doc doc' a b.
HasObject doc doc' =>
Text
-> SchemaP doc Object [Pair] a b -> SchemaP doc' Value Value a b
object Text
"BotUserView" (SchemaP SwaggerDoc Object [Pair] BotUserView BotUserView
 -> ValueSchema NamedSwaggerDoc BotUserView)
-> SchemaP SwaggerDoc Object [Pair] BotUserView BotUserView
-> ValueSchema NamedSwaggerDoc BotUserView
forall a b. (a -> b) -> a -> b
$
      UserId
-> Name -> ColourId -> Maybe Handle -> Maybe TeamId -> BotUserView
BotUserView
        (UserId
 -> Name -> ColourId -> Maybe Handle -> Maybe TeamId -> BotUserView)
-> SchemaP SwaggerDoc Object [Pair] BotUserView UserId
-> SchemaP
     SwaggerDoc
     Object
     [Pair]
     BotUserView
     (Name -> ColourId -> Maybe Handle -> Maybe TeamId -> BotUserView)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> BotUserView -> UserId
botUserViewId (BotUserView -> UserId)
-> SchemaP SwaggerDoc Object [Pair] UserId UserId
-> SchemaP SwaggerDoc Object [Pair] BotUserView 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
"id" SchemaP NamedSwaggerDoc Value Value UserId UserId
forall a. ToSchema a => ValueSchema NamedSwaggerDoc a
schema
        SchemaP
  SwaggerDoc
  Object
  [Pair]
  BotUserView
  (Name -> ColourId -> Maybe Handle -> Maybe TeamId -> BotUserView)
-> SchemaP SwaggerDoc Object [Pair] BotUserView Name
-> SchemaP
     SwaggerDoc
     Object
     [Pair]
     BotUserView
     (ColourId -> Maybe Handle -> Maybe TeamId -> BotUserView)
forall a b.
SchemaP SwaggerDoc Object [Pair] BotUserView (a -> b)
-> SchemaP SwaggerDoc Object [Pair] BotUserView a
-> SchemaP SwaggerDoc Object [Pair] BotUserView b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> BotUserView -> Name
botUserViewName (BotUserView -> Name)
-> SchemaP SwaggerDoc Object [Pair] Name Name
-> SchemaP SwaggerDoc Object [Pair] BotUserView Name
forall (p :: * -> * -> *) a a' b.
Profunctor p =>
(a -> a') -> p a' b -> p a b
.= Text
-> SchemaP NamedSwaggerDoc Value Value Name Name
-> SchemaP SwaggerDoc Object [Pair] Name Name
forall doc' doc a b.
HasField doc' doc =>
Text
-> SchemaP doc' Value Value a b -> SchemaP doc Object [Pair] a b
field Text
"name" SchemaP NamedSwaggerDoc Value Value Name Name
forall a. ToSchema a => ValueSchema NamedSwaggerDoc a
schema
        SchemaP
  SwaggerDoc
  Object
  [Pair]
  BotUserView
  (ColourId -> Maybe Handle -> Maybe TeamId -> BotUserView)
-> SchemaP SwaggerDoc Object [Pair] BotUserView ColourId
-> SchemaP
     SwaggerDoc
     Object
     [Pair]
     BotUserView
     (Maybe Handle -> Maybe TeamId -> BotUserView)
forall a b.
SchemaP SwaggerDoc Object [Pair] BotUserView (a -> b)
-> SchemaP SwaggerDoc Object [Pair] BotUserView a
-> SchemaP SwaggerDoc Object [Pair] BotUserView b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> BotUserView -> ColourId
botUserViewColour (BotUserView -> ColourId)
-> SchemaP SwaggerDoc Object [Pair] ColourId ColourId
-> SchemaP SwaggerDoc Object [Pair] BotUserView ColourId
forall (p :: * -> * -> *) a a' b.
Profunctor p =>
(a -> a') -> p a' b -> p a b
.= Text
-> SchemaP NamedSwaggerDoc Value Value ColourId ColourId
-> SchemaP SwaggerDoc Object [Pair] ColourId ColourId
forall doc' doc a b.
HasField doc' doc =>
Text
-> SchemaP doc' Value Value a b -> SchemaP doc Object [Pair] a b
field Text
"accent_id" SchemaP NamedSwaggerDoc Value Value ColourId ColourId
forall a. ToSchema a => ValueSchema NamedSwaggerDoc a
schema
        SchemaP
  SwaggerDoc
  Object
  [Pair]
  BotUserView
  (Maybe Handle -> Maybe TeamId -> BotUserView)
-> SchemaP SwaggerDoc Object [Pair] BotUserView (Maybe Handle)
-> SchemaP
     SwaggerDoc Object [Pair] BotUserView (Maybe TeamId -> BotUserView)
forall a b.
SchemaP SwaggerDoc Object [Pair] BotUserView (a -> b)
-> SchemaP SwaggerDoc Object [Pair] BotUserView a
-> SchemaP SwaggerDoc Object [Pair] BotUserView b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> BotUserView -> Maybe Handle
botUserViewHandle (BotUserView -> Maybe Handle)
-> SchemaP SwaggerDoc Object [Pair] (Maybe Handle) (Maybe Handle)
-> SchemaP SwaggerDoc Object [Pair] BotUserView (Maybe Handle)
forall (p :: * -> * -> *) a a' b.
Profunctor p =>
(a -> a') -> p a' b -> p a b
.= Text
-> SchemaP NamedSwaggerDoc Value Value (Maybe Handle) Handle
-> SchemaP SwaggerDoc Object [Pair] (Maybe Handle) (Maybe Handle)
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
"handle" (Value
-> SchemaP NamedSwaggerDoc Value Value Handle Handle
-> SchemaP NamedSwaggerDoc Value Value (Maybe Handle) Handle
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 Handle Handle
forall a. ToSchema a => ValueSchema NamedSwaggerDoc a
schema)
        SchemaP
  SwaggerDoc Object [Pair] BotUserView (Maybe TeamId -> BotUserView)
-> SchemaP SwaggerDoc Object [Pair] BotUserView (Maybe TeamId)
-> SchemaP SwaggerDoc Object [Pair] BotUserView BotUserView
forall a b.
SchemaP SwaggerDoc Object [Pair] BotUserView (a -> b)
-> SchemaP SwaggerDoc Object [Pair] BotUserView a
-> SchemaP SwaggerDoc Object [Pair] BotUserView b
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
<*> BotUserView -> Maybe TeamId
botUserViewTeam (BotUserView -> Maybe TeamId)
-> SchemaP SwaggerDoc Object [Pair] (Maybe TeamId) (Maybe TeamId)
-> SchemaP SwaggerDoc Object [Pair] BotUserView (Maybe TeamId)
forall (p :: * -> * -> *) a a' b.
Profunctor p =>
(a -> a') -> p a' b -> p a b
.= Text
-> SchemaP NamedSwaggerDoc Value Value (Maybe TeamId) TeamId
-> SchemaP SwaggerDoc Object [Pair] (Maybe TeamId) (Maybe TeamId)
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
"team" (Value
-> SchemaP NamedSwaggerDoc Value Value TeamId TeamId
-> SchemaP NamedSwaggerDoc Value Value (Maybe TeamId) TeamId
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 TeamId TeamId
forall a. ToSchema a => ValueSchema NamedSwaggerDoc a
schema)

makeLenses ''BotConvView