content: module Fission.CLI.Connected.Types (Config (..)) where
  
  import           Control.Concurrent.MVar
  import qualified Crypto.PubKey.Ed25519   as Ed25519
  
  import           Network.HTTP.Client     as HTTP
  import           Network.IPFS.Types      as IPFS
  
  import           Fission.Prelude         hiding (mask, uninterruptibleMask)
  
  import           Web.DID.Types
  
  import           Fission.CLI.Remote
  
  data Config = Config
    { httpManager   :: HTTP.Manager
    , secretKey     :: Ed25519.SecretKey
    , cliDID        :: DID
    , serverDID     :: DID
    , remote        :: Remote
    , logFunc       :: LogFunc
    , processCtx    :: ProcessContext
    , ipfsTimeout   :: IPFS.Timeout
    , peers         :: NonEmpty IPFS.Peer
    , ignoredFiles  :: [Text] -- ^ Directly for ipfsignore -- passing through verbatim.
    , ipfsDaemonVar :: MVar (Process () () ())
    }
    deriving Generic
  
  instance HasProcessContext Config where
    processContextL = lens processCtx \cfg newProcessCtx ->
      cfg { processCtx = newProcessCtx }
  
  instance HasLogFunc Config where
    logFuncL = lens logFunc \cfg newLogFunc' ->
      cfg { logFunc = newLogFunc' }
  