{-|
Module      : Reader
Description : Holds environment variables.
Copyright   : (c) Maurizio Dusi, 2024
License     : BSD
Maintainer  : Maurizio Dusi
Stability   : stable
Portability : POSIX

This module holds the environment variables used by the program.
-}

module Reader
    ( Env (..)
    , ReaderIO
    ) where

import           Control.Monad.Reader ( ReaderT )

import qualified Data.ByteString      as B

-- | Represents the environment configuration for the SFTP client.
data Env
  = Env { Env -> String
hostName           :: String
          -- ^ The hostname of the SFTP server.
        , Env -> Int
port               :: Int
          -- ^ The port number to connect to.
        , Env -> String
user               :: String
          -- ^ The username for authentication.
        , Env -> String
password           :: String
          -- ^ The password for authentication.
        , Env -> String
knownHosts         :: FilePath
          -- ^ The path to the known hosts file.
        , Env -> String
transferFrom       :: FilePath
          -- ^ The source file path for transfer.
        , Env -> String
transferTo         :: FilePath
          -- ^ The destination file path for transfer.
        , Env -> [ByteString]
transferExtensions :: [B.ByteString]
          -- ^ The list of file extensions to transfer.
        , Env -> Maybe String
archiveTo          :: Maybe FilePath
          -- ^ Optional path to archive transferred files.
        , Env -> Integer
date               :: Integer
          -- ^ The date for filtering files to transfer.
        , Env -> Bool
noOp               :: Bool
          -- ^ Whether or not to perform the actual transfer.
        }

type ReaderIO = ReaderT Env IO