{-# LANGUAGE GADTs #-}

module API.WebMoney.Internal.Query where

import           Data.Text (Text)

data QueryBestRates where
  QueryBestRates :: QueryBestRates

data QueryExchanges where
  QueryExchanges :: { queryExchType :: !Int } -> QueryExchanges

data QueryList where
  QueryList :: { listWMID :: !Text
               , listType :: !Int
               , listQueryID :: !(Maybe Text)
               , listCapitallerWMID :: !(Maybe Text) } -> QueryList
  QueryCounterList :: { listWMID :: !Text
                      , listType :: !Int
                      , listQueryID :: !(Maybe Text)
                      , listCapitallerWMID :: !(Maybe Text) } -> QueryList

data QueryTransDel where
  QueryTransDel :: { transDelWMID :: !Text
                   , transDelOperID :: !Text
                   , transDelCapitallerWMID :: !(Maybe Text) } -> QueryTransDel

data QueryTransChange where
  QueryTransChange :: { transChangeWMID :: !Text
                      , transChangeOperID :: !Text
                      , transChangeCursType :: !Bool
                      , transChangeCursAmount :: !Double
                      , transChangeCapitallerWMID :: !(Maybe Text) } -> QueryTransChange

data QueryTransUnion where
  QueryTransUnion :: { transUnionWMID :: !Text
                     , transUnionOperID :: !Text
                     , transUnionNewOperID :: !Text
                     , transUnionCapitallerWMID :: !(Maybe Text) } -> QueryTransUnion

data QueryTransNew where
  QueryTransNew :: { transNewWMID :: !Text
                   , transNewInPurse :: !Text
                   , transNewOutPurse :: !Text
                   , transNewInAmount :: !Double
                   , transNewOutAmount :: !Double
                   , transNewCapitallerWMID :: !(Maybe Text) } -> QueryTransNew

data QueryTransPurchase where
  QueryTransPurchase :: { transPurchaseWMID :: !Text
                        , transPurchaseSourceID :: !Text
                        , transPurchaseDestID :: !Text
                        , transPurchaseDestStamp :: !(Maybe Text)
                        , transPurchaseCapitallerWMID :: !(Maybe Text) } -> QueryTransPurchase

type HourStat     = Int
type DayStat      = (Int, Maybe HourStat)
type MonthStat    = (Int, Maybe DayStat)
type WeekStat     = Int
type YearStat     = (Int, Maybe MonthStat, Maybe WeekStat)
type YearWeekStat = (Int, Maybe MonthStat, WeekStat)

data QueryStats where
  QueryMonthStats :: { statsExchType :: !Int
                     , statsDate :: !(Maybe YearStat)
                     } -> QueryStats
  QueryWeekStats :: { statsExchType :: !Int
                    , statsYearDate :: !YearStat
                    } -> QueryStats
  QueryDayStats :: { statsExchType :: !Int
                    , statsYearDate :: !YearStat
                   } -> QueryStats
  QueryHourStats :: { statsExchType :: !Int
                    , statsYearWeekDate :: !YearWeekStat
                    } -> QueryStats

data QueryNewCounterList where
  QueryNewCounterList :: { listNewWMID :: !Text
                         , listNewQueryID :: !Text
                         , listNewCapitallerWMID :: !(Maybe Text) } -> QueryNewCounterList

