module Chu2.FFI where

import Data.ByteString (ByteString)

data RequestMethodData =
     OPTIONS
  |  GET
  |  HEAD
  |  POST
  |  PUT
  |  DELETE
  |  TRACE
  |  CONNECT
  deriving (Show, Read, Eq)



data StatusData = 
    OK
  | Created
  | Accepted
  | NoContent
  | MultipleChoices
  | MovedPermanently
  | SeeOther
  | NotModified
  | MovedTemporarily
  | BadRequest
  | Unauthorized
  | Forbidden
  | NotFound
  | MethodNotAllowed
  | NotAcceptable
  | Conflict
  | Gone
  | PreconditionFailed
  | RequestEntityTooLarge
  | RequestURItooLong
  | UnsupportedMediaType
  | NotImplemented
  | ServiceUnavailable
  deriving (Show)


type Field = String
type Headers = [Header]
type Header = (,) Field Field


type Chu2Errors = Field -> IO ()

data Chu2UrlSchemeData = HTTP | HTTPS
  deriving (Show)
  

data EnvData = EnvData
  {  requestMethod  :: RequestMethodData
  ,  scriptName     :: Field
  ,  pathInfo       :: Field
  ,  queryString    :: Field
  ,  serverName     :: Field
  ,  serverPort     :: Field
  ,  httpHeaders    :: Headers
  ,  chu2UrlScheme  :: Chu2UrlSchemeData
  ,  chu2Input      :: Field
  ,  chu2Headers    :: Headers
  }



data ResponseData = ResponseData
  {  status   :: StatusData
  ,  headers  :: Headers
  ,  body     :: Field
  }
  deriving (Show)



