    module Data.JSONPath.Types
      ( BeginningPoint (..),
        Condition (..),
        Comparable (..),
        JSONPathElement (..),
        UnionElement (..),
        FilterExpr (..),
        SingularPathElement (..),
        SingularPath (..),
      )
    where

    import Data.Scientific (Scientific)
    import Data.Text

    data BeginningPoint
      = Root
      | CurrentObject
      deriving (Int -> BeginningPoint -> ShowS
    [BeginningPoint] -> ShowS
    BeginningPoint -> String
    (Int -> BeginningPoint -> ShowS)
    -> (BeginningPoint -> String)
    -> ([BeginningPoint] -> ShowS)
    -> Show BeginningPoint
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> BeginningPoint -> ShowS
    showsPrec :: Int -> BeginningPoint -> ShowS
    $cshow :: BeginningPoint -> String
    show :: BeginningPoint -> String
    $cshowList :: [BeginningPoint] -> ShowS
    showList :: [BeginningPoint] -> ShowS
    Show, BeginningPoint -> BeginningPoint -> Bool
    (BeginningPoint -> BeginningPoint -> Bool)
    -> (BeginningPoint -> BeginningPoint -> Bool) -> Eq BeginningPoint
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: BeginningPoint -> BeginningPoint -> Bool
    == :: BeginningPoint -> BeginningPoint -> Bool
    $c/= :: BeginningPoint -> BeginningPoint -> Bool
    /= :: BeginningPoint -> BeginningPoint -> Bool
    Eq)

    -- | A JSONPath which finds at max one value, given a beginning point. Used by
    -- 'FilterExpr' for 'ExistsExpr' and 'ComparisonExpr'.
    data SingularPath
      = SingularPath BeginningPoint [SingularPathElement]
      deriving (Int -> SingularPath -> ShowS
    [SingularPath] -> ShowS
    SingularPath -> String
    (Int -> SingularPath -> ShowS)
    -> (SingularPath -> String)
    -> ([SingularPath] -> ShowS)
    -> Show SingularPath
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> SingularPath -> ShowS
    showsPrec :: Int -> SingularPath -> ShowS
    $cshow :: SingularPath -> String
    show :: SingularPath -> String
    $cshowList :: [SingularPath] -> ShowS
    showList :: [SingularPath] -> ShowS
    Show, SingularPath -> SingularPath -> Bool
    (SingularPath -> SingularPath -> Bool)
    -> (SingularPath -> SingularPath -> Bool) -> Eq SingularPath
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: SingularPath -> SingularPath -> Bool
    == :: SingularPath -> SingularPath -> Bool
    $c/= :: SingularPath -> SingularPath -> Bool
    /= :: SingularPath -> SingularPath -> Bool
    Eq)

    data SingularPathElement
      = Key Text
      | Index Int
      deriving (Int -> SingularPathElement -> ShowS
    [SingularPathElement] -> ShowS
    SingularPathElement -> String
    (Int -> SingularPathElement -> ShowS)
    -> (SingularPathElement -> String)
    -> ([SingularPathElement] -> ShowS)
    -> Show SingularPathElement
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> SingularPathElement -> ShowS
    showsPrec :: Int -> SingularPathElement -> ShowS
    $cshow :: SingularPathElement -> String
    show :: SingularPathElement -> String
    $cshowList :: [SingularPathElement] -> ShowS
    showList :: [SingularPathElement] -> ShowS
    Show, SingularPathElement -> SingularPathElement -> Bool
    (SingularPathElement -> SingularPathElement -> Bool)
    -> (SingularPathElement -> SingularPathElement -> Bool)
    -> Eq SingularPathElement
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: SingularPathElement -> SingularPathElement -> Bool
    == :: SingularPathElement -> SingularPathElement -> Bool
    $c/= :: SingularPathElement -> SingularPathElement -> Bool
    /= :: SingularPathElement -> SingularPathElement -> Bool
    Eq)

    data Comparable
      = CmpNumber Scientific
      | CmpString Text
      | CmpBool Bool
      | CmpNull
      | CmpPath SingularPath
      deriving (Int -> Comparable -> ShowS
    [Comparable] -> ShowS
    Comparable -> String
    (Int -> Comparable -> ShowS)
    -> (Comparable -> String)
    -> ([Comparable] -> ShowS)
    -> Show Comparable
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> Comparable -> ShowS
    showsPrec :: Int -> Comparable -> ShowS
    $cshow :: Comparable -> String
    show :: Comparable -> String
    $cshowList :: [Comparable] -> ShowS
    showList :: [Comparable] -> ShowS
    Show, Comparable -> Comparable -> Bool
    (Comparable -> Comparable -> Bool)
    -> (Comparable -> Comparable -> Bool) -> Eq Comparable
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: Comparable -> Comparable -> Bool
    == :: Comparable -> Comparable -> Bool
    $c/= :: Comparable -> Comparable -> Bool
    /= :: Comparable -> Comparable -> Bool
    Eq)

    data Condition
      = Equal
      | NotEqual
      | GreaterThan
      | SmallerThan
      | GreaterThanOrEqual
      | SmallerThanOrEqual
      deriving (Int -> Condition -> ShowS
    [Condition] -> ShowS
    Condition -> String
    (Int -> Condition -> ShowS)
    -> (Condition -> String)
    -> ([Condition] -> ShowS)
    -> Show Condition
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> Condition -> ShowS
    showsPrec :: Int -> Condition -> ShowS
    $cshow :: Condition -> String
    show :: Condition -> String
    $cshowList :: [Condition] -> ShowS
    showList :: [Condition] -> ShowS
    Show, Condition -> Condition -> Bool
    (Condition -> Condition -> Bool)
    -> (Condition -> Condition -> Bool) -> Eq Condition
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: Condition -> Condition -> Bool
    == :: Condition -> Condition -> Bool
    $c/= :: Condition -> Condition -> Bool
    /= :: Condition -> Condition -> Bool
    Eq)

    data FilterExpr
      = ExistsExpr SingularPath
      | ComparisonExpr Comparable Condition Comparable
      | And FilterExpr FilterExpr
      | Or FilterExpr FilterExpr
      | Not FilterExpr
      deriving (Int -> FilterExpr -> ShowS
    [FilterExpr] -> ShowS
    FilterExpr -> String
    (Int -> FilterExpr -> ShowS)
    -> (FilterExpr -> String)
    -> ([FilterExpr] -> ShowS)
    -> Show FilterExpr
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> FilterExpr -> ShowS
    showsPrec :: Int -> FilterExpr -> ShowS
    $cshow :: FilterExpr -> String
    show :: FilterExpr -> String
    $cshowList :: [FilterExpr] -> ShowS
    showList :: [FilterExpr] -> ShowS
    Show, FilterExpr -> FilterExpr -> Bool
    (FilterExpr -> FilterExpr -> Bool)
    -> (FilterExpr -> FilterExpr -> Bool) -> Eq FilterExpr
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: FilterExpr -> FilterExpr -> Bool
    == :: FilterExpr -> FilterExpr -> Bool
    $c/= :: FilterExpr -> FilterExpr -> Bool
    /= :: FilterExpr -> FilterExpr -> Bool
    Eq)

    -- | Elements which can occur inside a union
    data UnionElement
      = UEKeyChild Text
      | UEIndexChild Int
      | UESlice (Maybe Int) (Maybe Int) (Maybe Int)
      deriving (Int -> UnionElement -> ShowS
    [UnionElement] -> ShowS
    UnionElement -> String
    (Int -> UnionElement -> ShowS)
    -> (UnionElement -> String)
    -> ([UnionElement] -> ShowS)
    -> Show UnionElement
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> UnionElement -> ShowS
    showsPrec :: Int -> UnionElement -> ShowS
    $cshow :: UnionElement -> String
    show :: UnionElement -> String
    $cshowList :: [UnionElement] -> ShowS
    showList :: [UnionElement] -> ShowS
    Show, UnionElement -> UnionElement -> Bool
    (UnionElement -> UnionElement -> Bool)
    -> (UnionElement -> UnionElement -> Bool) -> Eq UnionElement
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: UnionElement -> UnionElement -> Bool
    == :: UnionElement -> UnionElement -> Bool
    $c/= :: UnionElement -> UnionElement -> Bool
    /= :: UnionElement -> UnionElement -> Bool
    Eq)

    -- | A 'JSONPath' is a list of 'JSONPathElement's.
    data JSONPathElement
      = -- | '$.foo' or '$["foo"]'
        KeyChild Text
      | -- | '$[1]'
        IndexChild Int
      | -- | '$[*]'
        AnyChild
      | -- | '$[1:7]', '$[0:10:2]', '$[::2]', '$[::]', etc.
        Slice (Maybe Int) (Maybe Int) (Maybe Int)
      | -- | '$[0,1,9]' or '$[0, 1:2, "foo", "bar"]'
        Union [UnionElement]
      | -- | '$[?(@.foo == 42)]', '$[?(@.foo > @.bar)]', etc.
        Filter FilterExpr
      | -- | '$..foo.bar'
        Search [JSONPathElement]
      deriving (Int -> JSONPathElement -> ShowS
    [JSONPathElement] -> ShowS
    JSONPathElement -> String
    (Int -> JSONPathElement -> ShowS)
    -> (JSONPathElement -> String)
    -> ([JSONPathElement] -> ShowS)
    -> Show JSONPathElement
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> JSONPathElement -> ShowS
    showsPrec :: Int -> JSONPathElement -> ShowS
    $cshow :: JSONPathElement -> String
    show :: JSONPathElement -> String
    $cshowList :: [JSONPathElement] -> ShowS
    showList :: [JSONPathElement] -> ShowS
    Show, JSONPathElement -> JSONPathElement -> Bool
    (JSONPathElement -> JSONPathElement -> Bool)
    -> (JSONPathElement -> JSONPathElement -> Bool)
    -> Eq JSONPathElement
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: JSONPathElement -> JSONPathElement -> Bool
    == :: JSONPathElement -> JSONPathElement -> Bool
    $c/= :: JSONPathElement -> JSONPathElement -> Bool
    /= :: JSONPathElement -> JSONPathElement -> Bool
    Eq)