{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE TypeOperators #-}

module Cachix.API.Deploy where

import Cachix.API (CachixAuth)
import qualified Cachix.Types.Deploy as Deploy
import qualified Cachix.Types.DeployResponse as DeployResponse
import Protolude
import Servant.API
import Servant.API.Generic

data DeployAPI route = DeployAPI
  { forall route.
DeployAPI route
-> route
   :- (CachixAuth
       :> ("deploy"
           :> ("activate"
               :> (ReqBody '[JSON] Deploy :> Post '[JSON] DeployResponse))))
activate ::
      route
        :- CachixAuth
        :> "deploy"
        :> "activate"
        :> ReqBody '[JSON] Deploy.Deploy
        :> Post '[JSON] DeployResponse.DeployResponse
  }
  deriving (forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall route x. Rep (DeployAPI route) x -> DeployAPI route
forall route x. DeployAPI route -> Rep (DeployAPI route) x
$cto :: forall route x. Rep (DeployAPI route) x -> DeployAPI route
$cfrom :: forall route x. DeployAPI route -> Rep (DeployAPI route) x
Generic)

type API = "api" :> "v1" :> ToServantApi DeployAPI

api :: Proxy API
api :: Proxy API
api = forall {k} (t :: k). Proxy t
Proxy