-- Copyright (c) 2016-present, Facebook, Inc.
-- All rights reserved.
--
-- This source code is licensed under the BSD-style license found in the
-- LICENSE file in the root directory of this source tree.


{-# LANGUAGE GADTs #-}
module Duckling.Rules.ES
  ( defaultRules
  , langRules
  , localeRules
  ) where

import Prelude

import qualified Duckling.AmountOfMoney.ES.Rules as AmountOfMoney
import Duckling.Dimensions.Types
import qualified Duckling.Distance.ES.Rules as Distance
import Duckling.Locale
import qualified Duckling.Numeral.ES.AR.Rules as NumeralAR
import qualified Duckling.Numeral.ES.CL.Rules as NumeralCL
import qualified Duckling.Numeral.ES.CO.Rules as NumeralCO
import qualified Duckling.Numeral.ES.ES.Rules as NumeralES
import qualified Duckling.Numeral.ES.MX.Rules as NumeralMX
import qualified Duckling.Numeral.ES.PE.Rules as NumeralPE
import qualified Duckling.Numeral.ES.Rules as Numeral
import qualified Duckling.Numeral.ES.VE.Rules as NumeralVE
import qualified Duckling.Ordinal.ES.Rules as Ordinal
import qualified Duckling.Region as R
  ( Region
      ( AR
      , ES
      )
  )
import qualified Duckling.Temperature.ES.Rules as Temperature
import qualified Duckling.Time.ES.Rules as Time
import qualified Duckling.TimeGrain.ES.Rules as TimeGrain
import Duckling.Types
import qualified Duckling.Volume.ES.Rules as Volume
import qualified Duckling.Duration.ES.Rules as Duration
import qualified Duckling.Quantity.ES.Rules as Quantity

defaultRules :: Seal Dimension -> [Rule]
defaultRules :: Seal Dimension -> [Rule]
defaultRules dim :: Seal Dimension
dim@(Seal Dimension a
Numeral) =
  [Rule]
NumeralES.rulesBackwardCompatible [Rule] -> [Rule] -> [Rule]
forall a. [a] -> [a] -> [a]
++ Seal Dimension -> [Rule]
langRules Seal Dimension
dim
defaultRules Seal Dimension
dim = Seal Dimension -> [Rule]
langRules Seal Dimension
dim

localeRules :: Region -> Seal Dimension -> [Rule]
localeRules :: Region -> Seal Dimension -> [Rule]
localeRules Region
R.AR (Seal Dimension a
Numeral) = [Rule]
NumeralAR.rules
localeRules Region
CL (Seal Dimension a
Numeral) = [Rule]
NumeralCL.rules
localeRules Region
CO (Seal Dimension a
Numeral) = [Rule]
NumeralCO.rules
localeRules Region
R.ES (Seal Dimension a
Numeral) = [Rule]
NumeralES.rules
localeRules Region
MX (Seal Dimension a
Numeral) = [Rule]
NumeralMX.rules
localeRules Region
PE (Seal Dimension a
Numeral) = [Rule]
NumeralPE.rules
localeRules Region
VE (Seal Dimension a
Numeral) = [Rule]
NumeralVE.rules
localeRules Region
region (Seal (CustomDimension a
dim)) = Region -> a -> [Rule]
forall a. CustomDimension a => Region -> a -> [Rule]
dimLocaleRules Region
region a
dim
localeRules Region
_ Seal Dimension
_ = []

langRules :: Seal Dimension -> [Rule]
langRules :: Seal Dimension -> [Rule]
langRules (Seal Dimension a
AmountOfMoney) = [Rule]
AmountOfMoney.rules
langRules (Seal Dimension a
CreditCardNumber) = []
langRules (Seal Dimension a
Distance) = [Rule]
Distance.rules
langRules (Seal Dimension a
Duration) = [Rule]
Duration.rules
langRules (Seal Dimension a
Email) = []
langRules (Seal Dimension a
Numeral) = [Rule]
Numeral.rules
langRules (Seal Dimension a
Ordinal) = [Rule]
Ordinal.rules
langRules (Seal Dimension a
PhoneNumber) = []
langRules (Seal Dimension a
Quantity) = [Rule]
Quantity.rules
langRules (Seal Dimension a
RegexMatch) = []
langRules (Seal Dimension a
Temperature) = [Rule]
Temperature.rules
langRules (Seal Dimension a
Time) = [Rule]
Time.rules
langRules (Seal Dimension a
TimeGrain) = [Rule]
TimeGrain.rules
langRules (Seal Dimension a
Url) = []
langRules (Seal Dimension a
Volume) = [Rule]
Volume.rules
langRules (Seal (CustomDimension a
dim)) = Lang -> a -> [Rule]
forall a. CustomDimension a => Lang -> a -> [Rule]
dimLangRules Lang
ES a
dim