{-# LANGUAGE DeriveGeneric #-}

module Server.DTOs.Documents (Documents (..), DocumentsQuery (..)) where

import Data.Aeson (FromJSON, ToJSON)
import Data.OpenApi (ToSchema)
import Data.Vector (Vector)

import GHC.Generics (Generic)

import Docs.Document (Document)
import UserManagement.Group (GroupID)
import UserManagement.User (UserID)

data Documents = Documents
    { Documents -> Vector Document
documents :: Vector Document
    , Documents -> DocumentsQuery
query :: DocumentsQuery
    }
    deriving ((forall x. Documents -> Rep Documents x)
-> (forall x. Rep Documents x -> Documents) -> Generic Documents
forall x. Rep Documents x -> Documents
forall x. Documents -> Rep Documents x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. Documents -> Rep Documents x
from :: forall x. Documents -> Rep Documents x
$cto :: forall x. Rep Documents x -> Documents
to :: forall x. Rep Documents x -> Documents
Generic)

instance ToJSON Documents

instance FromJSON Documents

instance ToSchema Documents

data DocumentsQuery = DocumentsQuery
    { DocumentsQuery -> Maybe UserID
user :: Maybe UserID
    , DocumentsQuery -> Maybe GroupID
group :: Maybe GroupID
    }
    deriving ((forall x. DocumentsQuery -> Rep DocumentsQuery x)
-> (forall x. Rep DocumentsQuery x -> DocumentsQuery)
-> Generic DocumentsQuery
forall x. Rep DocumentsQuery x -> DocumentsQuery
forall x. DocumentsQuery -> Rep DocumentsQuery x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. DocumentsQuery -> Rep DocumentsQuery x
from :: forall x. DocumentsQuery -> Rep DocumentsQuery x
$cto :: forall x. Rep DocumentsQuery x -> DocumentsQuery
to :: forall x. Rep DocumentsQuery x -> DocumentsQuery
Generic)

instance ToJSON DocumentsQuery

instance FromJSON DocumentsQuery

instance ToSchema DocumentsQuery