{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc)

The interface allows unified access to control flipping and rotation
operations of video-sources or operators.

/Since: 1.10/
-}

#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
       && !defined(__HADDOCK_VERSION__))

module GI.GstVideo.Interfaces.VideoDirection
    (

-- * Exported types
    VideoDirection(..)                      ,
    noVideoDirection                        ,
    IsVideoDirection                        ,
    toVideoDirection                        ,


 -- * Properties
-- ** videoDirection #attr:videoDirection#
{- | /No description available in the introspection data./
-}
#if ENABLE_OVERLOADING
    VideoDirectionVideoDirectionPropertyInfo,
#endif
    constructVideoDirectionVideoDirection   ,
    getVideoDirectionVideoDirection         ,
    setVideoDirectionVideoDirection         ,
#if ENABLE_OVERLOADING
    videoDirectionVideoDirection            ,
#endif




    ) where

import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P

import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL

import qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.GstVideo.Enums as GstVideo.Enums

-- interface VideoDirection 
-- | Memory-managed wrapper type.
newtype VideoDirection = VideoDirection (ManagedPtr VideoDirection)
-- | A convenience alias for `Nothing` :: `Maybe` `VideoDirection`.
noVideoDirection :: Maybe VideoDirection
noVideoDirection = Nothing

#if ENABLE_OVERLOADING
type instance O.SignalList VideoDirection = VideoDirectionSignalList
type VideoDirectionSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

#endif

foreign import ccall "gst_video_direction_get_type"
    c_gst_video_direction_get_type :: IO GType

instance GObject VideoDirection where
    gobjectType = c_gst_video_direction_get_type


-- | Type class for types which can be safely cast to `VideoDirection`, for instance with `toVideoDirection`.
class (GObject o, O.IsDescendantOf VideoDirection o) => IsVideoDirection o
instance (GObject o, O.IsDescendantOf VideoDirection o) => IsVideoDirection o

instance O.HasParentTypes VideoDirection
type instance O.ParentTypes VideoDirection = '[GObject.Object.Object]

-- | Cast to `VideoDirection`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toVideoDirection :: (MonadIO m, IsVideoDirection o) => o -> m VideoDirection
toVideoDirection = liftIO . unsafeCastTo VideoDirection

-- VVV Prop "video-direction"
   -- Type: TInterface (Name {namespace = "GstVideo", name = "VideoOrientationMethod"})
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstruct]
   -- Nullable: (Nothing,Nothing)

{- |
Get the value of the “@video-direction@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' videoDirection #videoDirection
@
-}
getVideoDirectionVideoDirection :: (MonadIO m, IsVideoDirection o) => o -> m GstVideo.Enums.VideoOrientationMethod
getVideoDirectionVideoDirection obj = liftIO $ B.Properties.getObjectPropertyEnum obj "video-direction"

{- |
Set the value of the “@video-direction@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' videoDirection [ #videoDirection 'Data.GI.Base.Attributes.:=' value ]
@
-}
setVideoDirectionVideoDirection :: (MonadIO m, IsVideoDirection o) => o -> GstVideo.Enums.VideoOrientationMethod -> m ()
setVideoDirectionVideoDirection obj val = liftIO $ B.Properties.setObjectPropertyEnum obj "video-direction" val

{- |
Construct a `GValueConstruct` with valid value for the “@video-direction@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructVideoDirectionVideoDirection :: (IsVideoDirection o) => GstVideo.Enums.VideoOrientationMethod -> IO (GValueConstruct o)
constructVideoDirectionVideoDirection val = B.Properties.constructObjectPropertyEnum "video-direction" val

#if ENABLE_OVERLOADING
data VideoDirectionVideoDirectionPropertyInfo
instance AttrInfo VideoDirectionVideoDirectionPropertyInfo where
    type AttrAllowedOps VideoDirectionVideoDirectionPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint VideoDirectionVideoDirectionPropertyInfo = (~) GstVideo.Enums.VideoOrientationMethod
    type AttrBaseTypeConstraint VideoDirectionVideoDirectionPropertyInfo = IsVideoDirection
    type AttrGetType VideoDirectionVideoDirectionPropertyInfo = GstVideo.Enums.VideoOrientationMethod
    type AttrLabel VideoDirectionVideoDirectionPropertyInfo = "video-direction"
    type AttrOrigin VideoDirectionVideoDirectionPropertyInfo = VideoDirection
    attrGet _ = getVideoDirectionVideoDirection
    attrSet _ = setVideoDirectionVideoDirection
    attrConstruct _ = constructVideoDirectionVideoDirection
    attrClear _ = undefined
#endif

#if ENABLE_OVERLOADING
instance O.HasAttributeList VideoDirection
type instance O.AttributeList VideoDirection = VideoDirectionAttributeList
type VideoDirectionAttributeList = ('[ '("videoDirection", VideoDirectionVideoDirectionPropertyInfo)] :: [(Symbol, *)])
#endif

#if ENABLE_OVERLOADING
videoDirectionVideoDirection :: AttrLabelProxy "videoDirection"
videoDirectionVideoDirection = AttrLabelProxy

#endif

#if ENABLE_OVERLOADING
type family ResolveVideoDirectionMethod (t :: Symbol) (o :: *) :: * where
    ResolveVideoDirectionMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveVideoDirectionMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveVideoDirectionMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveVideoDirectionMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveVideoDirectionMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveVideoDirectionMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveVideoDirectionMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveVideoDirectionMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveVideoDirectionMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveVideoDirectionMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveVideoDirectionMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveVideoDirectionMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveVideoDirectionMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveVideoDirectionMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveVideoDirectionMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveVideoDirectionMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveVideoDirectionMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveVideoDirectionMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveVideoDirectionMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveVideoDirectionMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveVideoDirectionMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveVideoDirectionMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveVideoDirectionMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveVideoDirectionMethod t VideoDirection, O.MethodInfo info VideoDirection p) => OL.IsLabel t (VideoDirection -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
    fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif

#endif