module Charon.Backend.Json.BackendArgs
  ( backendArgs,
  )
where

import Charon.Backend.Data (Backend (BackendJson))
import Charon.Backend.Default.BackendArgs
  ( BackendArgs
      ( MkBackendArgs,
        backend,
        fromCorePathData,
        makePathData,
        toCorePathData
      ),
  )
import Charon.Backend.Json.PathData qualified as Json.PathData
import Charon.Prelude

backendArgs ::
  ( MonadAsync m,
    MonadCatch m,
    MonadLoggerNS m,
    MonadPathReader m,
    MonadPosixCompat m,
    MonadTerminal m
  ) =>
  BackendArgs m Json.PathData.PathData
backendArgs :: forall (m :: * -> *).
(MonadAsync m, MonadCatch m, MonadLoggerNS m, MonadPathReader m,
 MonadPosixCompat m, MonadTerminal m) =>
BackendArgs m PathData
backendArgs =
  MkBackendArgs
    { $sel:backend:MkBackendArgs :: Backend
backend = Backend
BackendJson,
      $sel:makePathData:MkBackendArgs :: Timestamp
-> PathI 'TrashHome
-> PathI 'TrashEntryOriginalPath
-> m (PathData, PathTypeW)
makePathData = Timestamp
-> PathI 'TrashHome
-> PathI 'TrashEntryOriginalPath
-> m (PathData, PathTypeW)
forall (m :: * -> *).
(HasCallStack, MonadAsync m, MonadCatch m, MonadLoggerNS m,
 MonadPathReader m, MonadPosixCompat m, MonadTerminal m) =>
Timestamp
-> PathI 'TrashHome
-> PathI 'TrashEntryOriginalPath
-> m (PathData, PathTypeW)
Json.PathData.toPathData,
      $sel:toCorePathData:MkBackendArgs :: PathI 'TrashHome -> PathData -> m PathData
toCorePathData = (PathData -> m PathData)
-> PathI 'TrashHome -> PathData -> m PathData
forall a b. a -> b -> a
const (PathData -> m PathData
forall a. a -> m a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (PathData -> m PathData)
-> (PathData -> PathData) -> PathData -> m PathData
forall b c a. (b -> c) -> (a -> b) -> a -> c
. PathData -> PathData
Json.PathData.toCorePathData),
      $sel:fromCorePathData:MkBackendArgs :: PathData -> PathData
fromCorePathData = PathData -> PathData
Json.PathData.fromCorePathData
    }