{-# LANGUAGE DeriveGeneric #-}

module Database.EJDB2.CollectionMeta where

import           Data.Aeson               ( FromJSON )
import           Data.Int

import           Database.EJDB2.IndexMeta

import           GHC.Generics

-- | Metadata about collection.
data CollectionMeta =
    CollectionMeta { CollectionMeta -> String
name    :: String        -- ^ Collection name
                   , CollectionMeta -> Int64
dbid    :: Int64         -- ^ Collection database ID
                   , CollectionMeta -> Int64
rnum    :: Int64         -- ^ Number of documents in collection
                   , CollectionMeta -> [IndexMeta]
indexes :: [IndexMeta]   -- ^ List of collections indexes
                   }
    deriving ( CollectionMeta -> CollectionMeta -> Bool
(CollectionMeta -> CollectionMeta -> Bool)
-> (CollectionMeta -> CollectionMeta -> Bool) -> Eq CollectionMeta
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CollectionMeta -> CollectionMeta -> Bool
$c/= :: CollectionMeta -> CollectionMeta -> Bool
== :: CollectionMeta -> CollectionMeta -> Bool
$c== :: CollectionMeta -> CollectionMeta -> Bool
Eq, (forall x. CollectionMeta -> Rep CollectionMeta x)
-> (forall x. Rep CollectionMeta x -> CollectionMeta)
-> Generic CollectionMeta
forall x. Rep CollectionMeta x -> CollectionMeta
forall x. CollectionMeta -> Rep CollectionMeta x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CollectionMeta x -> CollectionMeta
$cfrom :: forall x. CollectionMeta -> Rep CollectionMeta x
Generic, Int -> CollectionMeta -> ShowS
[CollectionMeta] -> ShowS
CollectionMeta -> String
(Int -> CollectionMeta -> ShowS)
-> (CollectionMeta -> String)
-> ([CollectionMeta] -> ShowS)
-> Show CollectionMeta
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CollectionMeta] -> ShowS
$cshowList :: [CollectionMeta] -> ShowS
show :: CollectionMeta -> String
$cshow :: CollectionMeta -> String
showsPrec :: Int -> CollectionMeta -> ShowS
$cshowsPrec :: Int -> CollectionMeta -> ShowS
Show )

instance FromJSON CollectionMeta