{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE UndecidableInstances #-}

module Hasura.RQL.IR.Delete
  ( AnnDel,
    AnnDelG (..),
    adTable,
    adWhere,
    adOutput,
    adAllCols,
    adNamingConvention,
  )
where

import Control.Lens.TH (makeLenses)
import Data.Kind (Type)
import Hasura.GraphQL.Schema.NamingCase (NamingCase)
import Hasura.Prelude
import Hasura.RQL.IR.BoolExp
import Hasura.RQL.IR.Returning
import Hasura.RQL.Types.Backend
import Hasura.RQL.Types.Column
import Hasura.SQL.Backend

data AnnDelG (b :: BackendType) (r :: Type) v = AnnDel
  { AnnDelG b r v -> TableName b
_adTable :: TableName b,
    AnnDelG b r v -> (AnnBoolExp b v, AnnBoolExp b v)
_adWhere :: (AnnBoolExp b v, AnnBoolExp b v),
    AnnDelG b r v -> MutationOutputG b r v
_adOutput :: MutationOutputG b r v,
    AnnDelG b r v -> [ColumnInfo b]
_adAllCols :: [ColumnInfo b],
    AnnDelG b r v -> Maybe NamingCase
_adNamingConvention :: Maybe NamingCase
  }
  deriving (a -> AnnDelG b r b -> AnnDelG b r a
(a -> b) -> AnnDelG b r a -> AnnDelG b r b
(forall a b. (a -> b) -> AnnDelG b r a -> AnnDelG b r b)
-> (forall a b. a -> AnnDelG b r b -> AnnDelG b r a)
-> Functor (AnnDelG b r)
forall a b. a -> AnnDelG b r b -> AnnDelG b r a
forall a b. (a -> b) -> AnnDelG b r a -> AnnDelG b r b
forall (b :: BackendType) r a b.
Backend b =>
a -> AnnDelG b r b -> AnnDelG b r a
forall (b :: BackendType) r a b.
Backend b =>
(a -> b) -> AnnDelG b r a -> AnnDelG b r b
forall (f :: * -> *).
(forall a b. (a -> b) -> f a -> f b)
-> (forall a b. a -> f b -> f a) -> Functor f
<$ :: a -> AnnDelG b r b -> AnnDelG b r a
$c<$ :: forall (b :: BackendType) r a b.
Backend b =>
a -> AnnDelG b r b -> AnnDelG b r a
fmap :: (a -> b) -> AnnDelG b r a -> AnnDelG b r b
$cfmap :: forall (b :: BackendType) r a b.
Backend b =>
(a -> b) -> AnnDelG b r a -> AnnDelG b r b
Functor, AnnDelG b r a -> Bool
(a -> m) -> AnnDelG b r a -> m
(a -> b -> b) -> b -> AnnDelG b r a -> b
(forall m. Monoid m => AnnDelG b r m -> m)
-> (forall m a. Monoid m => (a -> m) -> AnnDelG b r a -> m)
-> (forall m a. Monoid m => (a -> m) -> AnnDelG b r a -> m)
-> (forall a b. (a -> b -> b) -> b -> AnnDelG b r a -> b)
-> (forall a b. (a -> b -> b) -> b -> AnnDelG b r a -> b)
-> (forall b a. (b -> a -> b) -> b -> AnnDelG b r a -> b)
-> (forall b a. (b -> a -> b) -> b -> AnnDelG b r a -> b)
-> (forall a. (a -> a -> a) -> AnnDelG b r a -> a)
-> (forall a. (a -> a -> a) -> AnnDelG b r a -> a)
-> (forall a. AnnDelG b r a -> [a])
-> (forall a. AnnDelG b r a -> Bool)
-> (forall a. AnnDelG b r a -> Int)
-> (forall a. Eq a => a -> AnnDelG b r a -> Bool)
-> (forall a. Ord a => AnnDelG b r a -> a)
-> (forall a. Ord a => AnnDelG b r a -> a)
-> (forall a. Num a => AnnDelG b r a -> a)
-> (forall a. Num a => AnnDelG b r a -> a)
-> Foldable (AnnDelG b r)
forall a. Eq a => a -> AnnDelG b r a -> Bool
forall a. Num a => AnnDelG b r a -> a
forall a. Ord a => AnnDelG b r a -> a
forall m. Monoid m => AnnDelG b r m -> m
forall a. AnnDelG b r a -> Bool
forall a. AnnDelG b r a -> Int
forall a. AnnDelG b r a -> [a]
forall a. (a -> a -> a) -> AnnDelG b r a -> a
forall m a. Monoid m => (a -> m) -> AnnDelG b r a -> m
forall b a. (b -> a -> b) -> b -> AnnDelG b r a -> b
forall a b. (a -> b -> b) -> b -> AnnDelG b r a -> b
forall (b :: BackendType) r a.
(Backend b, Eq a) =>
a -> AnnDelG b r a -> Bool
forall (b :: BackendType) r a.
(Backend b, Num a) =>
AnnDelG b r a -> a
forall (b :: BackendType) r a.
(Backend b, Ord a) =>
AnnDelG b r a -> a
forall (b :: BackendType) r m.
(Backend b, Monoid m) =>
AnnDelG b r m -> m
forall (b :: BackendType) r a. Backend b => AnnDelG b r a -> Bool
forall (b :: BackendType) r a. Backend b => AnnDelG b r a -> Int
forall (b :: BackendType) r a. Backend b => AnnDelG b r a -> [a]
forall (b :: BackendType) r a.
Backend b =>
(a -> a -> a) -> AnnDelG b r a -> a
forall (b :: BackendType) r m a.
(Backend b, Monoid m) =>
(a -> m) -> AnnDelG b r a -> m
forall (b :: BackendType) r b a.
Backend b =>
(b -> a -> b) -> b -> AnnDelG b r a -> b
forall (b :: BackendType) r a b.
Backend b =>
(a -> b -> b) -> b -> AnnDelG b r a -> b
forall (t :: * -> *).
(forall m. Monoid m => t m -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall m a. Monoid m => (a -> m) -> t a -> m)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall a b. (a -> b -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall b a. (b -> a -> b) -> b -> t a -> b)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. (a -> a -> a) -> t a -> a)
-> (forall a. t a -> [a])
-> (forall a. t a -> Bool)
-> (forall a. t a -> Int)
-> (forall a. Eq a => a -> t a -> Bool)
-> (forall a. Ord a => t a -> a)
-> (forall a. Ord a => t a -> a)
-> (forall a. Num a => t a -> a)
-> (forall a. Num a => t a -> a)
-> Foldable t
product :: AnnDelG b r a -> a
$cproduct :: forall (b :: BackendType) r a.
(Backend b, Num a) =>
AnnDelG b r a -> a
sum :: AnnDelG b r a -> a
$csum :: forall (b :: BackendType) r a.
(Backend b, Num a) =>
AnnDelG b r a -> a
minimum :: AnnDelG b r a -> a
$cminimum :: forall (b :: BackendType) r a.
(Backend b, Ord a) =>
AnnDelG b r a -> a
maximum :: AnnDelG b r a -> a
$cmaximum :: forall (b :: BackendType) r a.
(Backend b, Ord a) =>
AnnDelG b r a -> a
elem :: a -> AnnDelG b r a -> Bool
$celem :: forall (b :: BackendType) r a.
(Backend b, Eq a) =>
a -> AnnDelG b r a -> Bool
length :: AnnDelG b r a -> Int
$clength :: forall (b :: BackendType) r a. Backend b => AnnDelG b r a -> Int
null :: AnnDelG b r a -> Bool
$cnull :: forall (b :: BackendType) r a. Backend b => AnnDelG b r a -> Bool
toList :: AnnDelG b r a -> [a]
$ctoList :: forall (b :: BackendType) r a. Backend b => AnnDelG b r a -> [a]
foldl1 :: (a -> a -> a) -> AnnDelG b r a -> a
$cfoldl1 :: forall (b :: BackendType) r a.
Backend b =>
(a -> a -> a) -> AnnDelG b r a -> a
foldr1 :: (a -> a -> a) -> AnnDelG b r a -> a
$cfoldr1 :: forall (b :: BackendType) r a.
Backend b =>
(a -> a -> a) -> AnnDelG b r a -> a
foldl' :: (b -> a -> b) -> b -> AnnDelG b r a -> b
$cfoldl' :: forall (b :: BackendType) r b a.
Backend b =>
(b -> a -> b) -> b -> AnnDelG b r a -> b
foldl :: (b -> a -> b) -> b -> AnnDelG b r a -> b
$cfoldl :: forall (b :: BackendType) r b a.
Backend b =>
(b -> a -> b) -> b -> AnnDelG b r a -> b
foldr' :: (a -> b -> b) -> b -> AnnDelG b r a -> b
$cfoldr' :: forall (b :: BackendType) r a b.
Backend b =>
(a -> b -> b) -> b -> AnnDelG b r a -> b
foldr :: (a -> b -> b) -> b -> AnnDelG b r a -> b
$cfoldr :: forall (b :: BackendType) r a b.
Backend b =>
(a -> b -> b) -> b -> AnnDelG b r a -> b
foldMap' :: (a -> m) -> AnnDelG b r a -> m
$cfoldMap' :: forall (b :: BackendType) r m a.
(Backend b, Monoid m) =>
(a -> m) -> AnnDelG b r a -> m
foldMap :: (a -> m) -> AnnDelG b r a -> m
$cfoldMap :: forall (b :: BackendType) r m a.
(Backend b, Monoid m) =>
(a -> m) -> AnnDelG b r a -> m
fold :: AnnDelG b r m -> m
$cfold :: forall (b :: BackendType) r m.
(Backend b, Monoid m) =>
AnnDelG b r m -> m
Foldable, Functor (AnnDelG b r)
Foldable (AnnDelG b r)
Functor (AnnDelG b r)
-> Foldable (AnnDelG b r)
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> AnnDelG b r a -> f (AnnDelG b r b))
-> (forall (f :: * -> *) a.
    Applicative f =>
    AnnDelG b r (f a) -> f (AnnDelG b r a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> AnnDelG b r a -> m (AnnDelG b r b))
-> (forall (m :: * -> *) a.
    Monad m =>
    AnnDelG b r (m a) -> m (AnnDelG b r a))
-> Traversable (AnnDelG b r)
(a -> f b) -> AnnDelG b r a -> f (AnnDelG b r b)
forall (b :: BackendType) r. Backend b => Functor (AnnDelG b r)
forall (b :: BackendType) r. Backend b => Foldable (AnnDelG b r)
forall (b :: BackendType) r (m :: * -> *) a.
(Backend b, Monad m) =>
AnnDelG b r (m a) -> m (AnnDelG b r a)
forall (b :: BackendType) r (f :: * -> *) a.
(Backend b, Applicative f) =>
AnnDelG b r (f a) -> f (AnnDelG b r a)
forall (b :: BackendType) r (m :: * -> *) a b.
(Backend b, Monad m) =>
(a -> m b) -> AnnDelG b r a -> m (AnnDelG b r b)
forall (b :: BackendType) r (f :: * -> *) a b.
(Backend b, Applicative f) =>
(a -> f b) -> AnnDelG b r a -> f (AnnDelG b r b)
forall (t :: * -> *).
Functor t
-> Foldable t
-> (forall (f :: * -> *) a b.
    Applicative f =>
    (a -> f b) -> t a -> f (t b))
-> (forall (f :: * -> *) a. Applicative f => t (f a) -> f (t a))
-> (forall (m :: * -> *) a b.
    Monad m =>
    (a -> m b) -> t a -> m (t b))
-> (forall (m :: * -> *) a. Monad m => t (m a) -> m (t a))
-> Traversable t
forall (m :: * -> *) a.
Monad m =>
AnnDelG b r (m a) -> m (AnnDelG b r a)
forall (f :: * -> *) a.
Applicative f =>
AnnDelG b r (f a) -> f (AnnDelG b r a)
forall (m :: * -> *) a b.
Monad m =>
(a -> m b) -> AnnDelG b r a -> m (AnnDelG b r b)
forall (f :: * -> *) a b.
Applicative f =>
(a -> f b) -> AnnDelG b r a -> f (AnnDelG b r b)
sequence :: AnnDelG b r (m a) -> m (AnnDelG b r a)
$csequence :: forall (b :: BackendType) r (m :: * -> *) a.
(Backend b, Monad m) =>
AnnDelG b r (m a) -> m (AnnDelG b r a)
mapM :: (a -> m b) -> AnnDelG b r a -> m (AnnDelG b r b)
$cmapM :: forall (b :: BackendType) r (m :: * -> *) a b.
(Backend b, Monad m) =>
(a -> m b) -> AnnDelG b r a -> m (AnnDelG b r b)
sequenceA :: AnnDelG b r (f a) -> f (AnnDelG b r a)
$csequenceA :: forall (b :: BackendType) r (f :: * -> *) a.
(Backend b, Applicative f) =>
AnnDelG b r (f a) -> f (AnnDelG b r a)
traverse :: (a -> f b) -> AnnDelG b r a -> f (AnnDelG b r b)
$ctraverse :: forall (b :: BackendType) r (f :: * -> *) a b.
(Backend b, Applicative f) =>
(a -> f b) -> AnnDelG b r a -> f (AnnDelG b r b)
$cp2Traversable :: forall (b :: BackendType) r. Backend b => Foldable (AnnDelG b r)
$cp1Traversable :: forall (b :: BackendType) r. Backend b => Functor (AnnDelG b r)
Traversable)

type AnnDel b = AnnDelG b Void (SQLExpression b)

deriving instance
  ( Backend b,
    Show (AnnBoolExp b a),
    Show (MutationOutputG b r a),
    Show a
  ) =>
  Show (AnnDelG b r a)

$(makeLenses ''AnnDelG)