------------------------------------------------------------------------
-- |
-- Module        : Data.Minecraft.Classic.Protocol
-- Copyright     : (c) 2016 Michael Carpenter
-- License       : BSD3
-- Maintainer    : Michael Carpenter <oldmanmike.dev@gmail.com>
-- Stability     : experimental
-- Portability   : portable
--
------------------------------------------------------------------------

module Data.Minecraft.Internal.Builder
  ( buildWord8
  , buildWord16
  , buildWord32
  , buildWord64
  , buildInt8
  , buildInt16
  , buildInt32
  , buildInt64
  , buildFloat
  , buildDouble
  , buildBool
  , buildText
  , buildByteString
  ) where

import            Data.ByteString         as B
import            Data.ByteString.Builder
import            Data.Int
import            Data.Text               as T
import            Data.Word

buildWord8 :: Word8 -> Builder
buildWord8 = word8
{-# INLINE buildWord8 #-}

buildWord16 :: Word16 -> Builder
buildWord16 = word16BE
{-# INLINE buildWord16 #-}

buildWord32 :: Word32 -> Builder
buildWord32 = word32BE
{-# INLINE buildWord32 #-}

buildWord64 :: Word64 -> Builder
buildWord64 = word64BE
{-# INLINE buildWord64 #-}

buildFloat :: Float -> Builder
buildFloat = floatBE
{-# INLINE buildFloat #-}

buildDouble :: Double -> Builder
buildDouble = doubleBE
{-# INLINE buildDouble #-}

buildInt8 :: Int8 -> Builder
buildInt8 = int8
{-# INLINE buildInt8 #-}

buildInt16 :: Int16 -> Builder
buildInt16 = int16BE
{-# INLINE buildInt16 #-}

buildInt32 :: Int32 -> Builder
buildInt32 = int32BE
{-# INLINE buildInt32 #-}

buildInt64 :: Int64 -> Builder
buildInt64 = int64BE
{-# INLINE buildInt64 #-}

buildBool :: Bool -> Builder
buildBool = word8 . toEnum . fromEnum
{-# INLINE buildBool #-}

buildText :: Text -> Builder
buildText = undefined

buildByteString :: ByteString -> Builder
buildByteString = byteString
