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

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

import Control.Lens.TH (makeLenses)
import Data.Kind (Type)
import Hasura.Prelude
import Hasura.RQL.IR.BoolExp
import Hasura.RQL.IR.Returning
import Hasura.RQL.Types.Backend
import Hasura.RQL.Types.BackendType
import Hasura.RQL.Types.Column
import Hasura.RQL.Types.Common
import Hasura.RQL.Types.NamingCase (NamingCase)
import Hasura.RQL.Types.Permission

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