module Tahoe.Directory.Internal.Types where

import qualified Data.ByteString as B
import qualified Data.Text as T

-- | A collection of references to other objects.
newtype Directory = Directory
    { Directory -> [Entry]
directoryChildren :: [Entry]
    }
    deriving (Directory -> Directory -> Bool
(Directory -> Directory -> Bool)
-> (Directory -> Directory -> Bool) -> Eq Directory
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Directory -> Directory -> Bool
$c/= :: Directory -> Directory -> Bool
== :: Directory -> Directory -> Bool
$c== :: Directory -> Directory -> Bool
Eq, Int -> Directory -> ShowS
[Directory] -> ShowS
Directory -> String
(Int -> Directory -> ShowS)
-> (Directory -> String)
-> ([Directory] -> ShowS)
-> Show Directory
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Directory] -> ShowS
$cshowList :: [Directory] -> ShowS
show :: Directory -> String
$cshow :: Directory -> String
showsPrec :: Int -> Directory -> ShowS
$cshowsPrec :: Int -> Directory -> ShowS
Show)

-- | A reference to an object of any kind.
data Entry = Entry
    { -- | The name of this entry in its containing directory.  XXX What if UTF-8 decoding fails?
      Entry -> Text
entryName :: T.Text
    , -- | A capability for reading the contents of this entry. XXX Structured cap instead
      Entry -> ByteString
entryReader :: B.ByteString
    , -- | An encrypted capability for performing writes to this entry. XXX
      -- Document the encryption scheme.
      Entry -> ByteString
entryEncryptedWriter :: B.ByteString
    , -- | Additional metadata about this entry such as last modification time. XXX How to represent this mixed type collection?
      Entry -> ByteString
entryMetadata :: B.ByteString
    }
    deriving (Entry -> Entry -> Bool
(Entry -> Entry -> Bool) -> (Entry -> Entry -> Bool) -> Eq Entry
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Entry -> Entry -> Bool
$c/= :: Entry -> Entry -> Bool
== :: Entry -> Entry -> Bool
$c== :: Entry -> Entry -> Bool
Eq, Int -> Entry -> ShowS
[Entry] -> ShowS
Entry -> String
(Int -> Entry -> ShowS)
-> (Entry -> String) -> ([Entry] -> ShowS) -> Show Entry
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Entry] -> ShowS
$cshowList :: [Entry] -> ShowS
show :: Entry -> String
$cshow :: Entry -> String
showsPrec :: Int -> Entry -> ShowS
$cshowsPrec :: Int -> Entry -> ShowS
Show)