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

Represents a day between January 1, Year 1 and a few thousand years in
the future. None of its members should be accessed directly.

If the 'GI.GLib.Structs.Date.Date'-struct is obtained from 'GI.GLib.Structs.Date.dateNew', it will be safe
to mutate but invalid and thus not safe for calendrical computations.

If it\'s declared on the stack, it will contain garbage so must be
initialized with 'GI.GLib.Structs.Date.dateClear'. 'GI.GLib.Structs.Date.dateClear' makes the date invalid
but sane. An invalid date doesn\'t represent a day, it\'s \"empty.\" A date
becomes valid after you set it to a Julian day or you set a day, month,
and year.
-}

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

module GI.GLib.Structs.Date
    (

-- * Exported types
    Date(..)                                ,
    newZeroDate                             ,
    noDate                                  ,


 -- * Methods
-- ** addDays #method:addDays#

#if ENABLE_OVERLOADING
    DateAddDaysMethodInfo                   ,
#endif
    dateAddDays                             ,


-- ** addMonths #method:addMonths#

#if ENABLE_OVERLOADING
    DateAddMonthsMethodInfo                 ,
#endif
    dateAddMonths                           ,


-- ** addYears #method:addYears#

#if ENABLE_OVERLOADING
    DateAddYearsMethodInfo                  ,
#endif
    dateAddYears                            ,


-- ** clamp #method:clamp#

#if ENABLE_OVERLOADING
    DateClampMethodInfo                     ,
#endif
    dateClamp                               ,


-- ** clear #method:clear#

#if ENABLE_OVERLOADING
    DateClearMethodInfo                     ,
#endif
    dateClear                               ,


-- ** compare #method:compare#

#if ENABLE_OVERLOADING
    DateCompareMethodInfo                   ,
#endif
    dateCompare                             ,


-- ** copy #method:copy#

#if ENABLE_OVERLOADING
    DateCopyMethodInfo                      ,
#endif
    dateCopy                                ,


-- ** daysBetween #method:daysBetween#

#if ENABLE_OVERLOADING
    DateDaysBetweenMethodInfo               ,
#endif
    dateDaysBetween                         ,


-- ** free #method:free#

#if ENABLE_OVERLOADING
    DateFreeMethodInfo                      ,
#endif
    dateFree                                ,


-- ** getDay #method:getDay#

#if ENABLE_OVERLOADING
    DateGetDayMethodInfo                    ,
#endif
    dateGetDay                              ,


-- ** getDayOfYear #method:getDayOfYear#

#if ENABLE_OVERLOADING
    DateGetDayOfYearMethodInfo              ,
#endif
    dateGetDayOfYear                        ,


-- ** getDaysInMonth #method:getDaysInMonth#

    dateGetDaysInMonth                      ,


-- ** getIso8601WeekOfYear #method:getIso8601WeekOfYear#

#if ENABLE_OVERLOADING
    DateGetIso8601WeekOfYearMethodInfo      ,
#endif
    dateGetIso8601WeekOfYear                ,


-- ** getJulian #method:getJulian#

#if ENABLE_OVERLOADING
    DateGetJulianMethodInfo                 ,
#endif
    dateGetJulian                           ,


-- ** getMondayWeekOfYear #method:getMondayWeekOfYear#

#if ENABLE_OVERLOADING
    DateGetMondayWeekOfYearMethodInfo       ,
#endif
    dateGetMondayWeekOfYear                 ,


-- ** getMondayWeeksInYear #method:getMondayWeeksInYear#

    dateGetMondayWeeksInYear                ,


-- ** getMonth #method:getMonth#

#if ENABLE_OVERLOADING
    DateGetMonthMethodInfo                  ,
#endif
    dateGetMonth                            ,


-- ** getSundayWeekOfYear #method:getSundayWeekOfYear#

#if ENABLE_OVERLOADING
    DateGetSundayWeekOfYearMethodInfo       ,
#endif
    dateGetSundayWeekOfYear                 ,


-- ** getSundayWeeksInYear #method:getSundayWeeksInYear#

    dateGetSundayWeeksInYear                ,


-- ** getWeekday #method:getWeekday#

#if ENABLE_OVERLOADING
    DateGetWeekdayMethodInfo                ,
#endif
    dateGetWeekday                          ,


-- ** getYear #method:getYear#

#if ENABLE_OVERLOADING
    DateGetYearMethodInfo                   ,
#endif
    dateGetYear                             ,


-- ** isFirstOfMonth #method:isFirstOfMonth#

#if ENABLE_OVERLOADING
    DateIsFirstOfMonthMethodInfo            ,
#endif
    dateIsFirstOfMonth                      ,


-- ** isLastOfMonth #method:isLastOfMonth#

#if ENABLE_OVERLOADING
    DateIsLastOfMonthMethodInfo             ,
#endif
    dateIsLastOfMonth                       ,


-- ** isLeapYear #method:isLeapYear#

    dateIsLeapYear                          ,


-- ** new #method:new#

    dateNew                                 ,


-- ** newDmy #method:newDmy#

    dateNewDmy                              ,


-- ** newJulian #method:newJulian#

    dateNewJulian                           ,


-- ** order #method:order#

#if ENABLE_OVERLOADING
    DateOrderMethodInfo                     ,
#endif
    dateOrder                               ,


-- ** setDay #method:setDay#

#if ENABLE_OVERLOADING
    DateSetDayMethodInfo                    ,
#endif
    dateSetDay                              ,


-- ** setDmy #method:setDmy#

#if ENABLE_OVERLOADING
    DateSetDmyMethodInfo                    ,
#endif
    dateSetDmy                              ,


-- ** setJulian #method:setJulian#

#if ENABLE_OVERLOADING
    DateSetJulianMethodInfo                 ,
#endif
    dateSetJulian                           ,


-- ** setMonth #method:setMonth#

#if ENABLE_OVERLOADING
    DateSetMonthMethodInfo                  ,
#endif
    dateSetMonth                            ,


-- ** setParse #method:setParse#

#if ENABLE_OVERLOADING
    DateSetParseMethodInfo                  ,
#endif
    dateSetParse                            ,


-- ** setTime #method:setTime#

#if ENABLE_OVERLOADING
    DateSetTimeMethodInfo                   ,
#endif
    dateSetTime                             ,


-- ** setTimeT #method:setTimeT#

#if ENABLE_OVERLOADING
    DateSetTimeTMethodInfo                  ,
#endif
    dateSetTimeT                            ,


-- ** setTimeVal #method:setTimeVal#

#if ENABLE_OVERLOADING
    DateSetTimeValMethodInfo                ,
#endif
    dateSetTimeVal                          ,


-- ** setYear #method:setYear#

#if ENABLE_OVERLOADING
    DateSetYearMethodInfo                   ,
#endif
    dateSetYear                             ,


-- ** strftime #method:strftime#

    dateStrftime                            ,


-- ** subtractDays #method:subtractDays#

#if ENABLE_OVERLOADING
    DateSubtractDaysMethodInfo              ,
#endif
    dateSubtractDays                        ,


-- ** subtractMonths #method:subtractMonths#

#if ENABLE_OVERLOADING
    DateSubtractMonthsMethodInfo            ,
#endif
    dateSubtractMonths                      ,


-- ** subtractYears #method:subtractYears#

#if ENABLE_OVERLOADING
    DateSubtractYearsMethodInfo             ,
#endif
    dateSubtractYears                       ,


-- ** toStructTm #method:toStructTm#

#if ENABLE_OVERLOADING
    DateToStructTmMethodInfo                ,
#endif
    dateToStructTm                          ,


-- ** valid #method:valid#

#if ENABLE_OVERLOADING
    DateValidMethodInfo                     ,
#endif
    dateValid                               ,


-- ** validDay #method:validDay#

    dateValidDay                            ,


-- ** validDmy #method:validDmy#

    dateValidDmy                            ,


-- ** validJulian #method:validJulian#

    dateValidJulian                         ,


-- ** validMonth #method:validMonth#

    dateValidMonth                          ,


-- ** validWeekday #method:validWeekday#

    dateValidWeekday                        ,


-- ** validYear #method:validYear#

    dateValidYear                           ,




 -- * Properties
-- ** day #attr:day#
{- | the day of the day-month-year representation of the date,
    as a number between 1 and 31
-}
#if ENABLE_OVERLOADING
    date_day                                ,
#endif
    getDateDay                              ,
    setDateDay                              ,


-- ** dmy #attr:dmy#
{- | this is set if /@day@/, /@month@/ and /@year@/ are valid
-}
#if ENABLE_OVERLOADING
    date_dmy                                ,
#endif
    getDateDmy                              ,
    setDateDmy                              ,


-- ** julian #attr:julian#
{- | this bit is set if /@julianDays@/ is valid
-}
#if ENABLE_OVERLOADING
    date_julian                             ,
#endif
    getDateJulian                           ,
    setDateJulian                           ,


-- ** julianDays #attr:julianDays#
{- | the Julian representation of the date
-}
#if ENABLE_OVERLOADING
    date_julianDays                         ,
#endif
    getDateJulianDays                       ,
    setDateJulianDays                       ,


-- ** month #attr:month#
{- | the day of the day-month-year representation of the date,
    as a number between 1 and 12
-}
#if ENABLE_OVERLOADING
    date_month                              ,
#endif
    getDateMonth                            ,
    setDateMonth                            ,


-- ** year #attr:year#
{- | the day of the day-month-year representation of the date
-}
#if ENABLE_OVERLOADING
    date_year                               ,
#endif
    getDateYear                             ,
    setDateYear                             ,




    ) 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 {-# SOURCE #-} qualified GI.GLib.Enums as GLib.Enums
import {-# SOURCE #-} qualified GI.GLib.Structs.TimeVal as GLib.TimeVal

-- | Memory-managed wrapper type.
newtype Date = Date (ManagedPtr Date)
foreign import ccall "g_date_get_type" c_g_date_get_type ::
    IO GType

instance BoxedObject Date where
    boxedType _ = c_g_date_get_type

-- | Construct a `Date` struct initialized to zero.
newZeroDate :: MonadIO m => m Date
newZeroDate = liftIO $ callocBoxedBytes 24 >>= wrapBoxed Date

instance tag ~ 'AttrSet => Constructible Date tag where
    new _ attrs = do
        o <- newZeroDate
        GI.Attributes.set o attrs
        return o


-- | A convenience alias for `Nothing` :: `Maybe` `Date`.
noDate :: Maybe Date
noDate = Nothing

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

@
'Data.GI.Base.Attributes.get' date #julianDays
@
-}
getDateJulianDays :: MonadIO m => Date -> m Word32
getDateJulianDays s = liftIO $ withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 0) :: IO Word32
    return val

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

@
'Data.GI.Base.Attributes.set' date [ #julianDays 'Data.GI.Base.Attributes.:=' value ]
@
-}
setDateJulianDays :: MonadIO m => Date -> Word32 -> m ()
setDateJulianDays s val = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 0) (val :: Word32)

#if ENABLE_OVERLOADING
data DateJulianDaysFieldInfo
instance AttrInfo DateJulianDaysFieldInfo where
    type AttrAllowedOps DateJulianDaysFieldInfo = '[ 'AttrSet, 'AttrGet]
    type AttrSetTypeConstraint DateJulianDaysFieldInfo = (~) Word32
    type AttrBaseTypeConstraint DateJulianDaysFieldInfo = (~) Date
    type AttrGetType DateJulianDaysFieldInfo = Word32
    type AttrLabel DateJulianDaysFieldInfo = "julian_days"
    type AttrOrigin DateJulianDaysFieldInfo = Date
    attrGet _ = getDateJulianDays
    attrSet _ = setDateJulianDays
    attrConstruct = undefined
    attrClear _ = undefined

date_julianDays :: AttrLabelProxy "julianDays"
date_julianDays = AttrLabelProxy

#endif


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

@
'Data.GI.Base.Attributes.get' date #julian
@
-}
getDateJulian :: MonadIO m => Date -> m Word32
getDateJulian s = liftIO $ withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 4) :: IO Word32
    return val

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

@
'Data.GI.Base.Attributes.set' date [ #julian 'Data.GI.Base.Attributes.:=' value ]
@
-}
setDateJulian :: MonadIO m => Date -> Word32 -> m ()
setDateJulian s val = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 4) (val :: Word32)

#if ENABLE_OVERLOADING
data DateJulianFieldInfo
instance AttrInfo DateJulianFieldInfo where
    type AttrAllowedOps DateJulianFieldInfo = '[ 'AttrSet, 'AttrGet]
    type AttrSetTypeConstraint DateJulianFieldInfo = (~) Word32
    type AttrBaseTypeConstraint DateJulianFieldInfo = (~) Date
    type AttrGetType DateJulianFieldInfo = Word32
    type AttrLabel DateJulianFieldInfo = "julian"
    type AttrOrigin DateJulianFieldInfo = Date
    attrGet _ = getDateJulian
    attrSet _ = setDateJulian
    attrConstruct = undefined
    attrClear _ = undefined

date_julian :: AttrLabelProxy "julian"
date_julian = AttrLabelProxy

#endif


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

@
'Data.GI.Base.Attributes.get' date #dmy
@
-}
getDateDmy :: MonadIO m => Date -> m Word32
getDateDmy s = liftIO $ withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 8) :: IO Word32
    return val

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

@
'Data.GI.Base.Attributes.set' date [ #dmy 'Data.GI.Base.Attributes.:=' value ]
@
-}
setDateDmy :: MonadIO m => Date -> Word32 -> m ()
setDateDmy s val = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 8) (val :: Word32)

#if ENABLE_OVERLOADING
data DateDmyFieldInfo
instance AttrInfo DateDmyFieldInfo where
    type AttrAllowedOps DateDmyFieldInfo = '[ 'AttrSet, 'AttrGet]
    type AttrSetTypeConstraint DateDmyFieldInfo = (~) Word32
    type AttrBaseTypeConstraint DateDmyFieldInfo = (~) Date
    type AttrGetType DateDmyFieldInfo = Word32
    type AttrLabel DateDmyFieldInfo = "dmy"
    type AttrOrigin DateDmyFieldInfo = Date
    attrGet _ = getDateDmy
    attrSet _ = setDateDmy
    attrConstruct = undefined
    attrClear _ = undefined

date_dmy :: AttrLabelProxy "dmy"
date_dmy = AttrLabelProxy

#endif


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

@
'Data.GI.Base.Attributes.get' date #day
@
-}
getDateDay :: MonadIO m => Date -> m Word32
getDateDay s = liftIO $ withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 12) :: IO Word32
    return val

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

@
'Data.GI.Base.Attributes.set' date [ #day 'Data.GI.Base.Attributes.:=' value ]
@
-}
setDateDay :: MonadIO m => Date -> Word32 -> m ()
setDateDay s val = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 12) (val :: Word32)

#if ENABLE_OVERLOADING
data DateDayFieldInfo
instance AttrInfo DateDayFieldInfo where
    type AttrAllowedOps DateDayFieldInfo = '[ 'AttrSet, 'AttrGet]
    type AttrSetTypeConstraint DateDayFieldInfo = (~) Word32
    type AttrBaseTypeConstraint DateDayFieldInfo = (~) Date
    type AttrGetType DateDayFieldInfo = Word32
    type AttrLabel DateDayFieldInfo = "day"
    type AttrOrigin DateDayFieldInfo = Date
    attrGet _ = getDateDay
    attrSet _ = setDateDay
    attrConstruct = undefined
    attrClear _ = undefined

date_day :: AttrLabelProxy "day"
date_day = AttrLabelProxy

#endif


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

@
'Data.GI.Base.Attributes.get' date #month
@
-}
getDateMonth :: MonadIO m => Date -> m Word32
getDateMonth s = liftIO $ withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 16) :: IO Word32
    return val

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

@
'Data.GI.Base.Attributes.set' date [ #month 'Data.GI.Base.Attributes.:=' value ]
@
-}
setDateMonth :: MonadIO m => Date -> Word32 -> m ()
setDateMonth s val = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 16) (val :: Word32)

#if ENABLE_OVERLOADING
data DateMonthFieldInfo
instance AttrInfo DateMonthFieldInfo where
    type AttrAllowedOps DateMonthFieldInfo = '[ 'AttrSet, 'AttrGet]
    type AttrSetTypeConstraint DateMonthFieldInfo = (~) Word32
    type AttrBaseTypeConstraint DateMonthFieldInfo = (~) Date
    type AttrGetType DateMonthFieldInfo = Word32
    type AttrLabel DateMonthFieldInfo = "month"
    type AttrOrigin DateMonthFieldInfo = Date
    attrGet _ = getDateMonth
    attrSet _ = setDateMonth
    attrConstruct = undefined
    attrClear _ = undefined

date_month :: AttrLabelProxy "month"
date_month = AttrLabelProxy

#endif


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

@
'Data.GI.Base.Attributes.get' date #year
@
-}
getDateYear :: MonadIO m => Date -> m Word32
getDateYear s = liftIO $ withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 20) :: IO Word32
    return val

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

@
'Data.GI.Base.Attributes.set' date [ #year 'Data.GI.Base.Attributes.:=' value ]
@
-}
setDateYear :: MonadIO m => Date -> Word32 -> m ()
setDateYear s val = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 20) (val :: Word32)

#if ENABLE_OVERLOADING
data DateYearFieldInfo
instance AttrInfo DateYearFieldInfo where
    type AttrAllowedOps DateYearFieldInfo = '[ 'AttrSet, 'AttrGet]
    type AttrSetTypeConstraint DateYearFieldInfo = (~) Word32
    type AttrBaseTypeConstraint DateYearFieldInfo = (~) Date
    type AttrGetType DateYearFieldInfo = Word32
    type AttrLabel DateYearFieldInfo = "year"
    type AttrOrigin DateYearFieldInfo = Date
    attrGet _ = getDateYear
    attrSet _ = setDateYear
    attrConstruct = undefined
    attrClear _ = undefined

date_year :: AttrLabelProxy "year"
date_year = AttrLabelProxy

#endif



#if ENABLE_OVERLOADING
instance O.HasAttributeList Date
type instance O.AttributeList Date = DateAttributeList
type DateAttributeList = ('[ '("julianDays", DateJulianDaysFieldInfo), '("julian", DateJulianFieldInfo), '("dmy", DateDmyFieldInfo), '("day", DateDayFieldInfo), '("month", DateMonthFieldInfo), '("year", DateYearFieldInfo)] :: [(Symbol, *)])
#endif

-- method Date::new
-- method type : Constructor
-- Args : []
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GLib", name = "Date"}))
-- throws : False
-- Skip return : False

foreign import ccall "g_date_new" g_date_new ::
    IO (Ptr Date)

{- |
Allocates a 'GI.GLib.Structs.Date.Date' and initializes
it to a sane state. The new date will
be cleared (as if you\'d called 'GI.GLib.Structs.Date.dateClear') but invalid (it won\'t
represent an existing day). Free the return value with 'GI.GLib.Structs.Date.dateFree'.
-}
dateNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Date
    {- ^ __Returns:__ a newly-allocated 'GI.GLib.Structs.Date.Date' -}
dateNew  = liftIO $ do
    result <- g_date_new
    checkUnexpectedReturnNULL "dateNew" result
    result' <- (wrapBoxed Date) result
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Date::new_dmy
-- method type : Constructor
-- Args : [Arg {argCName = "day", argType = TBasicType TUInt8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "day of the month", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "month", argType = TInterface (Name {namespace = "GLib", name = "DateMonth"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "month of the year", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "year", argType = TBasicType TUInt16, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "year", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GLib", name = "Date"}))
-- throws : False
-- Skip return : False

foreign import ccall "g_date_new_dmy" g_date_new_dmy ::
    Word8 ->                                -- day : TBasicType TUInt8
    CUInt ->                                -- month : TInterface (Name {namespace = "GLib", name = "DateMonth"})
    Word16 ->                               -- year : TBasicType TUInt16
    IO (Ptr Date)

{- |
Like 'GI.GLib.Structs.Date.dateNew', but also sets the value of the date. Assuming the
day-month-year triplet you pass in represents an existing day, the
returned date will be valid.
-}
dateNewDmy ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word8
    {- ^ /@day@/: day of the month -}
    -> GLib.Enums.DateMonth
    {- ^ /@month@/: month of the year -}
    -> Word16
    {- ^ /@year@/: year -}
    -> m Date
    {- ^ __Returns:__ a newly-allocated 'GI.GLib.Structs.Date.Date' initialized with /@day@/, /@month@/, and /@year@/ -}
dateNewDmy day month year = liftIO $ do
    let month' = (fromIntegral . fromEnum) month
    result <- g_date_new_dmy day month' year
    checkUnexpectedReturnNULL "dateNewDmy" result
    result' <- (wrapBoxed Date) result
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Date::new_julian
-- method type : Constructor
-- Args : [Arg {argCName = "julian_day", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "days since January 1, Year 1", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GLib", name = "Date"}))
-- throws : False
-- Skip return : False

foreign import ccall "g_date_new_julian" g_date_new_julian ::
    Word32 ->                               -- julian_day : TBasicType TUInt32
    IO (Ptr Date)

{- |
Like 'GI.GLib.Structs.Date.dateNew', but also sets the value of the date. Assuming the
Julian day number you pass in is valid (greater than 0, less than an
unreasonably large number), the returned date will be valid.
-}
dateNewJulian ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word32
    {- ^ /@julianDay@/: days since January 1, Year 1 -}
    -> m Date
    {- ^ __Returns:__ a newly-allocated 'GI.GLib.Structs.Date.Date' initialized with /@julianDay@/ -}
dateNewJulian julianDay = liftIO $ do
    result <- g_date_new_julian julianDay
    checkUnexpectedReturnNULL "dateNewJulian" result
    result' <- (wrapBoxed Date) result
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Date::add_days
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDate to increment", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "n_days", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "number of days to move the date forward", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_date_add_days" g_date_add_days ::
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    Word32 ->                               -- n_days : TBasicType TUInt
    IO ()

{- |
Increments a date some number of days.
To move forward by weeks, add weeks*7 days.
The date must be valid.
-}
dateAddDays ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date@/: a 'GI.GLib.Structs.Date.Date' to increment -}
    -> Word32
    {- ^ /@nDays@/: number of days to move the date forward -}
    -> m ()
dateAddDays date nDays = liftIO $ do
    date' <- unsafeManagedPtrGetPtr date
    g_date_add_days date' nDays
    touchManagedPtr date
    return ()

#if ENABLE_OVERLOADING
data DateAddDaysMethodInfo
instance (signature ~ (Word32 -> m ()), MonadIO m) => O.MethodInfo DateAddDaysMethodInfo Date signature where
    overloadedMethod _ = dateAddDays

#endif

-- method Date::add_months
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDate to increment", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "n_months", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "number of months to move forward", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_date_add_months" g_date_add_months ::
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    Word32 ->                               -- n_months : TBasicType TUInt
    IO ()

{- |
Increments a date by some number of months.
If the day of the month is greater than 28,
this routine may change the day of the month
(because the destination month may not have
the current day in it). The date must be valid.
-}
dateAddMonths ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date@/: a 'GI.GLib.Structs.Date.Date' to increment -}
    -> Word32
    {- ^ /@nMonths@/: number of months to move forward -}
    -> m ()
dateAddMonths date nMonths = liftIO $ do
    date' <- unsafeManagedPtrGetPtr date
    g_date_add_months date' nMonths
    touchManagedPtr date
    return ()

#if ENABLE_OVERLOADING
data DateAddMonthsMethodInfo
instance (signature ~ (Word32 -> m ()), MonadIO m) => O.MethodInfo DateAddMonthsMethodInfo Date signature where
    overloadedMethod _ = dateAddMonths

#endif

-- method Date::add_years
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDate to increment", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "n_years", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "number of years to move forward", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_date_add_years" g_date_add_years ::
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    Word32 ->                               -- n_years : TBasicType TUInt
    IO ()

{- |
Increments a date by some number of years.
If the date is February 29, and the destination
year is not a leap year, the date will be changed
to February 28. The date must be valid.
-}
dateAddYears ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date@/: a 'GI.GLib.Structs.Date.Date' to increment -}
    -> Word32
    {- ^ /@nYears@/: number of years to move forward -}
    -> m ()
dateAddYears date nYears = liftIO $ do
    date' <- unsafeManagedPtrGetPtr date
    g_date_add_years date' nYears
    touchManagedPtr date
    return ()

#if ENABLE_OVERLOADING
data DateAddYearsMethodInfo
instance (signature ~ (Word32 -> m ()), MonadIO m) => O.MethodInfo DateAddYearsMethodInfo Date signature where
    overloadedMethod _ = dateAddYears

#endif

-- method Date::clamp
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDate to clamp", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "min_date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "minimum accepted value for @date", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "max_date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "maximum accepted value for @date", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_date_clamp" g_date_clamp ::
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    Ptr Date ->                             -- min_date : TInterface (Name {namespace = "GLib", name = "Date"})
    Ptr Date ->                             -- max_date : TInterface (Name {namespace = "GLib", name = "Date"})
    IO ()

{- |
If /@date@/ is prior to /@minDate@/, sets /@date@/ equal to /@minDate@/.
If /@date@/ falls after /@maxDate@/, sets /@date@/ equal to /@maxDate@/.
Otherwise, /@date@/ is unchanged.
Either of /@minDate@/ and /@maxDate@/ may be 'Nothing'.
All non-'Nothing' dates must be valid.
-}
dateClamp ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date@/: a 'GI.GLib.Structs.Date.Date' to clamp -}
    -> Date
    {- ^ /@minDate@/: minimum accepted value for /@date@/ -}
    -> Date
    {- ^ /@maxDate@/: maximum accepted value for /@date@/ -}
    -> m ()
dateClamp date minDate maxDate = liftIO $ do
    date' <- unsafeManagedPtrGetPtr date
    minDate' <- unsafeManagedPtrGetPtr minDate
    maxDate' <- unsafeManagedPtrGetPtr maxDate
    g_date_clamp date' minDate' maxDate'
    touchManagedPtr date
    touchManagedPtr minDate
    touchManagedPtr maxDate
    return ()

#if ENABLE_OVERLOADING
data DateClampMethodInfo
instance (signature ~ (Date -> Date -> m ()), MonadIO m) => O.MethodInfo DateClampMethodInfo Date signature where
    overloadedMethod _ = dateClamp

#endif

-- method Date::clear
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "pointer to one or more dates to clear", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "n_dates", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "number of dates to clear", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_date_clear" g_date_clear ::
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    Word32 ->                               -- n_dates : TBasicType TUInt
    IO ()

{- |
Initializes one or more 'GI.GLib.Structs.Date.Date' structs to a sane but invalid
state. The cleared dates will not represent an existing date, but will
not contain garbage. Useful to init a date declared on the stack.
Validity can be tested with 'GI.GLib.Structs.Date.dateValid'.
-}
dateClear ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date@/: pointer to one or more dates to clear -}
    -> Word32
    {- ^ /@nDates@/: number of dates to clear -}
    -> m ()
dateClear date nDates = liftIO $ do
    date' <- unsafeManagedPtrGetPtr date
    g_date_clear date' nDates
    touchManagedPtr date
    return ()

#if ENABLE_OVERLOADING
data DateClearMethodInfo
instance (signature ~ (Word32 -> m ()), MonadIO m) => O.MethodInfo DateClearMethodInfo Date signature where
    overloadedMethod _ = dateClear

#endif

-- method Date::compare
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "lhs", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "first date to compare", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "rhs", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "second date to compare", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "g_date_compare" g_date_compare ::
    Ptr Date ->                             -- lhs : TInterface (Name {namespace = "GLib", name = "Date"})
    Ptr Date ->                             -- rhs : TInterface (Name {namespace = "GLib", name = "Date"})
    IO Int32

{- |
@/qsort()/@-style comparison function for dates.
Both dates must be valid.
-}
dateCompare ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@lhs@/: first date to compare -}
    -> Date
    {- ^ /@rhs@/: second date to compare -}
    -> m Int32
    {- ^ __Returns:__ 0 for equal, less than zero if /@lhs@/ is less than /@rhs@/,
    greater than zero if /@lhs@/ is greater than /@rhs@/ -}
dateCompare lhs rhs = liftIO $ do
    lhs' <- unsafeManagedPtrGetPtr lhs
    rhs' <- unsafeManagedPtrGetPtr rhs
    result <- g_date_compare lhs' rhs'
    touchManagedPtr lhs
    touchManagedPtr rhs
    return result

#if ENABLE_OVERLOADING
data DateCompareMethodInfo
instance (signature ~ (Date -> m Int32), MonadIO m) => O.MethodInfo DateCompareMethodInfo Date signature where
    overloadedMethod _ = dateCompare

#endif

-- method Date::copy
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDate to copy", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GLib", name = "Date"}))
-- throws : False
-- Skip return : False

foreign import ccall "g_date_copy" g_date_copy ::
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    IO (Ptr Date)

{- |
Copies a GDate to a newly-allocated GDate. If the input was invalid
(as determined by 'GI.GLib.Structs.Date.dateValid'), the invalid state will be copied
as is into the new object.

/Since: 2.56/
-}
dateCopy ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date@/: a 'GI.GLib.Structs.Date.Date' to copy -}
    -> m Date
    {- ^ __Returns:__ a newly-allocated 'GI.GLib.Structs.Date.Date' initialized from /@date@/ -}
dateCopy date = liftIO $ do
    date' <- unsafeManagedPtrGetPtr date
    result <- g_date_copy date'
    checkUnexpectedReturnNULL "dateCopy" result
    result' <- (wrapBoxed Date) result
    touchManagedPtr date
    return result'

#if ENABLE_OVERLOADING
data DateCopyMethodInfo
instance (signature ~ (m Date), MonadIO m) => O.MethodInfo DateCopyMethodInfo Date signature where
    overloadedMethod _ = dateCopy

#endif

-- method Date::days_between
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date1", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the first date", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "date2", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the second date", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "g_date_days_between" g_date_days_between ::
    Ptr Date ->                             -- date1 : TInterface (Name {namespace = "GLib", name = "Date"})
    Ptr Date ->                             -- date2 : TInterface (Name {namespace = "GLib", name = "Date"})
    IO Int32

{- |
Computes the number of days between two dates.
If /@date2@/ is prior to /@date1@/, the returned value is negative.
Both dates must be valid.
-}
dateDaysBetween ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date1@/: the first date -}
    -> Date
    {- ^ /@date2@/: the second date -}
    -> m Int32
    {- ^ __Returns:__ the number of days between /@date1@/ and /@date2@/ -}
dateDaysBetween date1 date2 = liftIO $ do
    date1' <- unsafeManagedPtrGetPtr date1
    date2' <- unsafeManagedPtrGetPtr date2
    result <- g_date_days_between date1' date2'
    touchManagedPtr date1
    touchManagedPtr date2
    return result

#if ENABLE_OVERLOADING
data DateDaysBetweenMethodInfo
instance (signature ~ (Date -> m Int32), MonadIO m) => O.MethodInfo DateDaysBetweenMethodInfo Date signature where
    overloadedMethod _ = dateDaysBetween

#endif

-- method Date::free
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDate to free", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_date_free" g_date_free ::
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    IO ()

{- |
Frees a 'GI.GLib.Structs.Date.Date' returned from 'GI.GLib.Structs.Date.dateNew'.
-}
dateFree ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date@/: a 'GI.GLib.Structs.Date.Date' to free -}
    -> m ()
dateFree date = liftIO $ do
    date' <- unsafeManagedPtrGetPtr date
    g_date_free date'
    touchManagedPtr date
    return ()

#if ENABLE_OVERLOADING
data DateFreeMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo DateFreeMethodInfo Date signature where
    overloadedMethod _ = dateFree

#endif

-- method Date::get_day
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDate to extract the day of the month from", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt8)
-- throws : False
-- Skip return : False

foreign import ccall "g_date_get_day" g_date_get_day ::
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    IO Word8

{- |
Returns the day of the month. The date must be valid.
-}
dateGetDay ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date@/: a 'GI.GLib.Structs.Date.Date' to extract the day of the month from -}
    -> m Word8
    {- ^ __Returns:__ day of the month -}
dateGetDay date = liftIO $ do
    date' <- unsafeManagedPtrGetPtr date
    result <- g_date_get_day date'
    touchManagedPtr date
    return result

#if ENABLE_OVERLOADING
data DateGetDayMethodInfo
instance (signature ~ (m Word8), MonadIO m) => O.MethodInfo DateGetDayMethodInfo Date signature where
    overloadedMethod _ = dateGetDay

#endif

-- method Date::get_day_of_year
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDate to extract day of year from", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "g_date_get_day_of_year" g_date_get_day_of_year ::
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    IO Word32

{- |
Returns the day of the year, where Jan 1 is the first day of the
year. The date must be valid.
-}
dateGetDayOfYear ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date@/: a 'GI.GLib.Structs.Date.Date' to extract day of year from -}
    -> m Word32
    {- ^ __Returns:__ day of the year -}
dateGetDayOfYear date = liftIO $ do
    date' <- unsafeManagedPtrGetPtr date
    result <- g_date_get_day_of_year date'
    touchManagedPtr date
    return result

#if ENABLE_OVERLOADING
data DateGetDayOfYearMethodInfo
instance (signature ~ (m Word32), MonadIO m) => O.MethodInfo DateGetDayOfYearMethodInfo Date signature where
    overloadedMethod _ = dateGetDayOfYear

#endif

-- method Date::get_iso8601_week_of_year
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a valid #GDate", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "g_date_get_iso8601_week_of_year" g_date_get_iso8601_week_of_year ::
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    IO Word32

{- |
Returns the week of the year, where weeks are interpreted according
to ISO 8601.

/Since: 2.6/
-}
dateGetIso8601WeekOfYear ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date@/: a valid 'GI.GLib.Structs.Date.Date' -}
    -> m Word32
    {- ^ __Returns:__ ISO 8601 week number of the year. -}
dateGetIso8601WeekOfYear date = liftIO $ do
    date' <- unsafeManagedPtrGetPtr date
    result <- g_date_get_iso8601_week_of_year date'
    touchManagedPtr date
    return result

#if ENABLE_OVERLOADING
data DateGetIso8601WeekOfYearMethodInfo
instance (signature ~ (m Word32), MonadIO m) => O.MethodInfo DateGetIso8601WeekOfYearMethodInfo Date signature where
    overloadedMethod _ = dateGetIso8601WeekOfYear

#endif

-- method Date::get_julian
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDate to extract the Julian day from", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt32)
-- throws : False
-- Skip return : False

foreign import ccall "g_date_get_julian" g_date_get_julian ::
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    IO Word32

{- |
Returns the Julian day or \"serial number\" of the 'GI.GLib.Structs.Date.Date'. The
Julian day is simply the number of days since January 1, Year 1; i.e.,
January 1, Year 1 is Julian day 1; January 2, Year 1 is Julian day 2,
etc. The date must be valid.
-}
dateGetJulian ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date@/: a 'GI.GLib.Structs.Date.Date' to extract the Julian day from -}
    -> m Word32
    {- ^ __Returns:__ Julian day -}
dateGetJulian date = liftIO $ do
    date' <- unsafeManagedPtrGetPtr date
    result <- g_date_get_julian date'
    touchManagedPtr date
    return result

#if ENABLE_OVERLOADING
data DateGetJulianMethodInfo
instance (signature ~ (m Word32), MonadIO m) => O.MethodInfo DateGetJulianMethodInfo Date signature where
    overloadedMethod _ = dateGetJulian

#endif

-- method Date::get_monday_week_of_year
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDate", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "g_date_get_monday_week_of_year" g_date_get_monday_week_of_year ::
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    IO Word32

{- |
Returns the week of the year, where weeks are understood to start on
Monday. If the date is before the first Monday of the year, return 0.
The date must be valid.
-}
dateGetMondayWeekOfYear ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date@/: a 'GI.GLib.Structs.Date.Date' -}
    -> m Word32
    {- ^ __Returns:__ week of the year -}
dateGetMondayWeekOfYear date = liftIO $ do
    date' <- unsafeManagedPtrGetPtr date
    result <- g_date_get_monday_week_of_year date'
    touchManagedPtr date
    return result

#if ENABLE_OVERLOADING
data DateGetMondayWeekOfYearMethodInfo
instance (signature ~ (m Word32), MonadIO m) => O.MethodInfo DateGetMondayWeekOfYearMethodInfo Date signature where
    overloadedMethod _ = dateGetMondayWeekOfYear

#endif

-- method Date::get_month
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDate to get the month from", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GLib", name = "DateMonth"}))
-- throws : False
-- Skip return : False

foreign import ccall "g_date_get_month" g_date_get_month ::
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    IO CUInt

{- |
Returns the month of the year. The date must be valid.
-}
dateGetMonth ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date@/: a 'GI.GLib.Structs.Date.Date' to get the month from -}
    -> m GLib.Enums.DateMonth
    {- ^ __Returns:__ month of the year as a 'GI.GLib.Enums.DateMonth' -}
dateGetMonth date = liftIO $ do
    date' <- unsafeManagedPtrGetPtr date
    result <- g_date_get_month date'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr date
    return result'

#if ENABLE_OVERLOADING
data DateGetMonthMethodInfo
instance (signature ~ (m GLib.Enums.DateMonth), MonadIO m) => O.MethodInfo DateGetMonthMethodInfo Date signature where
    overloadedMethod _ = dateGetMonth

#endif

-- method Date::get_sunday_week_of_year
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDate", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "g_date_get_sunday_week_of_year" g_date_get_sunday_week_of_year ::
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    IO Word32

{- |
Returns the week of the year during which this date falls, if
weeks are understood to begin on Sunday. The date must be valid.
Can return 0 if the day is before the first Sunday of the year.
-}
dateGetSundayWeekOfYear ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date@/: a 'GI.GLib.Structs.Date.Date' -}
    -> m Word32
    {- ^ __Returns:__ week number -}
dateGetSundayWeekOfYear date = liftIO $ do
    date' <- unsafeManagedPtrGetPtr date
    result <- g_date_get_sunday_week_of_year date'
    touchManagedPtr date
    return result

#if ENABLE_OVERLOADING
data DateGetSundayWeekOfYearMethodInfo
instance (signature ~ (m Word32), MonadIO m) => O.MethodInfo DateGetSundayWeekOfYearMethodInfo Date signature where
    overloadedMethod _ = dateGetSundayWeekOfYear

#endif

-- method Date::get_weekday
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDate", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "GLib", name = "DateWeekday"}))
-- throws : False
-- Skip return : False

foreign import ccall "g_date_get_weekday" g_date_get_weekday ::
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    IO CUInt

{- |
Returns the day of the week for a 'GI.GLib.Structs.Date.Date'. The date must be valid.
-}
dateGetWeekday ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date@/: a 'GI.GLib.Structs.Date.Date' -}
    -> m GLib.Enums.DateWeekday
    {- ^ __Returns:__ day of the week as a 'GI.GLib.Enums.DateWeekday'. -}
dateGetWeekday date = liftIO $ do
    date' <- unsafeManagedPtrGetPtr date
    result <- g_date_get_weekday date'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr date
    return result'

#if ENABLE_OVERLOADING
data DateGetWeekdayMethodInfo
instance (signature ~ (m GLib.Enums.DateWeekday), MonadIO m) => O.MethodInfo DateGetWeekdayMethodInfo Date signature where
    overloadedMethod _ = dateGetWeekday

#endif

-- method Date::get_year
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDate", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt16)
-- throws : False
-- Skip return : False

foreign import ccall "g_date_get_year" g_date_get_year ::
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    IO Word16

{- |
Returns the year of a 'GI.GLib.Structs.Date.Date'. The date must be valid.
-}
dateGetYear ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date@/: a 'GI.GLib.Structs.Date.Date' -}
    -> m Word16
    {- ^ __Returns:__ year in which the date falls -}
dateGetYear date = liftIO $ do
    date' <- unsafeManagedPtrGetPtr date
    result <- g_date_get_year date'
    touchManagedPtr date
    return result

#if ENABLE_OVERLOADING
data DateGetYearMethodInfo
instance (signature ~ (m Word16), MonadIO m) => O.MethodInfo DateGetYearMethodInfo Date signature where
    overloadedMethod _ = dateGetYear

#endif

-- method Date::is_first_of_month
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDate to check", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_date_is_first_of_month" g_date_is_first_of_month ::
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    IO CInt

{- |
Returns 'True' if the date is on the first of a month.
The date must be valid.
-}
dateIsFirstOfMonth ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date@/: a 'GI.GLib.Structs.Date.Date' to check -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the date is the first of the month -}
dateIsFirstOfMonth date = liftIO $ do
    date' <- unsafeManagedPtrGetPtr date
    result <- g_date_is_first_of_month date'
    let result' = (/= 0) result
    touchManagedPtr date
    return result'

#if ENABLE_OVERLOADING
data DateIsFirstOfMonthMethodInfo
instance (signature ~ (m Bool), MonadIO m) => O.MethodInfo DateIsFirstOfMonthMethodInfo Date signature where
    overloadedMethod _ = dateIsFirstOfMonth

#endif

-- method Date::is_last_of_month
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDate to check", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_date_is_last_of_month" g_date_is_last_of_month ::
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    IO CInt

{- |
Returns 'True' if the date is the last day of the month.
The date must be valid.
-}
dateIsLastOfMonth ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date@/: a 'GI.GLib.Structs.Date.Date' to check -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the date is the last day of the month -}
dateIsLastOfMonth date = liftIO $ do
    date' <- unsafeManagedPtrGetPtr date
    result <- g_date_is_last_of_month date'
    let result' = (/= 0) result
    touchManagedPtr date
    return result'

#if ENABLE_OVERLOADING
data DateIsLastOfMonthMethodInfo
instance (signature ~ (m Bool), MonadIO m) => O.MethodInfo DateIsLastOfMonthMethodInfo Date signature where
    overloadedMethod _ = dateIsLastOfMonth

#endif

-- method Date::order
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date1", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the first date", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "date2", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the second date", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_date_order" g_date_order ::
    Ptr Date ->                             -- date1 : TInterface (Name {namespace = "GLib", name = "Date"})
    Ptr Date ->                             -- date2 : TInterface (Name {namespace = "GLib", name = "Date"})
    IO ()

{- |
Checks if /@date1@/ is less than or equal to /@date2@/,
and swap the values if this is not the case.
-}
dateOrder ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date1@/: the first date -}
    -> Date
    {- ^ /@date2@/: the second date -}
    -> m ()
dateOrder date1 date2 = liftIO $ do
    date1' <- unsafeManagedPtrGetPtr date1
    date2' <- unsafeManagedPtrGetPtr date2
    g_date_order date1' date2'
    touchManagedPtr date1
    touchManagedPtr date2
    return ()

#if ENABLE_OVERLOADING
data DateOrderMethodInfo
instance (signature ~ (Date -> m ()), MonadIO m) => O.MethodInfo DateOrderMethodInfo Date signature where
    overloadedMethod _ = dateOrder

#endif

-- method Date::set_day
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDate", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "day", argType = TBasicType TUInt8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "day to set", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_date_set_day" g_date_set_day ::
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    Word8 ->                                -- day : TBasicType TUInt8
    IO ()

{- |
Sets the day of the month for a 'GI.GLib.Structs.Date.Date'. If the resulting
day-month-year triplet is invalid, the date will be invalid.
-}
dateSetDay ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date@/: a 'GI.GLib.Structs.Date.Date' -}
    -> Word8
    {- ^ /@day@/: day to set -}
    -> m ()
dateSetDay date day = liftIO $ do
    date' <- unsafeManagedPtrGetPtr date
    g_date_set_day date' day
    touchManagedPtr date
    return ()

#if ENABLE_OVERLOADING
data DateSetDayMethodInfo
instance (signature ~ (Word8 -> m ()), MonadIO m) => O.MethodInfo DateSetDayMethodInfo Date signature where
    overloadedMethod _ = dateSetDay

#endif

-- method Date::set_dmy
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDate", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "day", argType = TBasicType TUInt8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "day", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "month", argType = TInterface (Name {namespace = "GLib", name = "DateMonth"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "month", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "y", argType = TBasicType TUInt16, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "year", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_date_set_dmy" g_date_set_dmy ::
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    Word8 ->                                -- day : TBasicType TUInt8
    CUInt ->                                -- month : TInterface (Name {namespace = "GLib", name = "DateMonth"})
    Word16 ->                               -- y : TBasicType TUInt16
    IO ()

{- |
Sets the value of a 'GI.GLib.Structs.Date.Date' from a day, month, and year.
The day-month-year triplet must be valid; if you aren\'t
sure it is, call 'GI.GLib.Functions.dateValidDmy' to check before you
set it.
-}
dateSetDmy ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date@/: a 'GI.GLib.Structs.Date.Date' -}
    -> Word8
    {- ^ /@day@/: day -}
    -> GLib.Enums.DateMonth
    {- ^ /@month@/: month -}
    -> Word16
    {- ^ /@y@/: year -}
    -> m ()
dateSetDmy date day month y = liftIO $ do
    date' <- unsafeManagedPtrGetPtr date
    let month' = (fromIntegral . fromEnum) month
    g_date_set_dmy date' day month' y
    touchManagedPtr date
    return ()

#if ENABLE_OVERLOADING
data DateSetDmyMethodInfo
instance (signature ~ (Word8 -> GLib.Enums.DateMonth -> Word16 -> m ()), MonadIO m) => O.MethodInfo DateSetDmyMethodInfo Date signature where
    overloadedMethod _ = dateSetDmy

#endif

-- method Date::set_julian
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDate", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "julian_date", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Julian day number (days since January 1, Year 1)", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_date_set_julian" g_date_set_julian ::
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    Word32 ->                               -- julian_date : TBasicType TUInt32
    IO ()

{- |
Sets the value of a 'GI.GLib.Structs.Date.Date' from a Julian day number.
-}
dateSetJulian ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date@/: a 'GI.GLib.Structs.Date.Date' -}
    -> Word32
    {- ^ /@julianDate@/: Julian day number (days since January 1, Year 1) -}
    -> m ()
dateSetJulian date julianDate = liftIO $ do
    date' <- unsafeManagedPtrGetPtr date
    g_date_set_julian date' julianDate
    touchManagedPtr date
    return ()

#if ENABLE_OVERLOADING
data DateSetJulianMethodInfo
instance (signature ~ (Word32 -> m ()), MonadIO m) => O.MethodInfo DateSetJulianMethodInfo Date signature where
    overloadedMethod _ = dateSetJulian

#endif

-- method Date::set_month
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDate", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "month", argType = TInterface (Name {namespace = "GLib", name = "DateMonth"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "month to set", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_date_set_month" g_date_set_month ::
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    CUInt ->                                -- month : TInterface (Name {namespace = "GLib", name = "DateMonth"})
    IO ()

{- |
Sets the month of the year for a 'GI.GLib.Structs.Date.Date'.  If the resulting
day-month-year triplet is invalid, the date will be invalid.
-}
dateSetMonth ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date@/: a 'GI.GLib.Structs.Date.Date' -}
    -> GLib.Enums.DateMonth
    {- ^ /@month@/: month to set -}
    -> m ()
dateSetMonth date month = liftIO $ do
    date' <- unsafeManagedPtrGetPtr date
    let month' = (fromIntegral . fromEnum) month
    g_date_set_month date' month'
    touchManagedPtr date
    return ()

#if ENABLE_OVERLOADING
data DateSetMonthMethodInfo
instance (signature ~ (GLib.Enums.DateMonth -> m ()), MonadIO m) => O.MethodInfo DateSetMonthMethodInfo Date signature where
    overloadedMethod _ = dateSetMonth

#endif

-- method Date::set_parse
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDate to fill in", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "str", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "string to parse", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_date_set_parse" g_date_set_parse ::
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    CString ->                              -- str : TBasicType TUTF8
    IO ()

{- |
Parses a user-inputted string /@str@/, and try to figure out what date it
represents, taking the [current locale][setlocale] into account. If the
string is successfully parsed, the date will be valid after the call.
Otherwise, it will be invalid. You should check using 'GI.GLib.Structs.Date.dateValid'
to see whether the parsing succeeded.

This function is not appropriate for file formats and the like; it
isn\'t very precise, and its exact behavior varies with the locale.
It\'s intended to be a heuristic routine that guesses what the user
means by a given string (and it does work pretty well in that
capacity).
-}
dateSetParse ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date@/: a 'GI.GLib.Structs.Date.Date' to fill in -}
    -> T.Text
    {- ^ /@str@/: string to parse -}
    -> m ()
dateSetParse date str = liftIO $ do
    date' <- unsafeManagedPtrGetPtr date
    str' <- textToCString str
    g_date_set_parse date' str'
    touchManagedPtr date
    freeMem str'
    return ()

#if ENABLE_OVERLOADING
data DateSetParseMethodInfo
instance (signature ~ (T.Text -> m ()), MonadIO m) => O.MethodInfo DateSetParseMethodInfo Date signature where
    overloadedMethod _ = dateSetParse

#endif

-- method Date::set_time
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDate.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "time_", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#GTime value to set.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_date_set_time" g_date_set_time ::
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    Int32 ->                                -- time_ : TBasicType TInt32
    IO ()

{-# DEPRECATED dateSetTime ["(Since version 2.10)","Use 'GI.GLib.Structs.Date.dateSetTimeT' instead."] #-}
{- |
Sets the value of a date from a @/GTime/@ value.
The time to date conversion is done using the user\'s current timezone.
-}
dateSetTime ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date@/: a 'GI.GLib.Structs.Date.Date'. -}
    -> Int32
    {- ^ /@time_@/: @/GTime/@ value to set. -}
    -> m ()
dateSetTime date time_ = liftIO $ do
    date' <- unsafeManagedPtrGetPtr date
    g_date_set_time date' time_
    touchManagedPtr date
    return ()

#if ENABLE_OVERLOADING
data DateSetTimeMethodInfo
instance (signature ~ (Int32 -> m ()), MonadIO m) => O.MethodInfo DateSetTimeMethodInfo Date signature where
    overloadedMethod _ = dateSetTime

#endif

-- method Date::set_time_t
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDate", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "timet", argType = TBasicType TLong, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "time_t value to set", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_date_set_time_t" g_date_set_time_t ::
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    CLong ->                                -- timet : TBasicType TLong
    IO ()

{- |
Sets the value of a date to the date corresponding to a time
specified as a time_t. The time to date conversion is done using
the user\'s current timezone.

To set the value of a date to the current day, you could write:

=== /C code/
>
> time_t now = time (NULL);
> if (now == (time_t) -1)
>   // handle the error
> g_date_set_time_t (date, now);


/Since: 2.10/
-}
dateSetTimeT ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date@/: a 'GI.GLib.Structs.Date.Date' -}
    -> CLong
    {- ^ /@timet@/: time_t value to set -}
    -> m ()
dateSetTimeT date timet = liftIO $ do
    date' <- unsafeManagedPtrGetPtr date
    g_date_set_time_t date' timet
    touchManagedPtr date
    return ()

#if ENABLE_OVERLOADING
data DateSetTimeTMethodInfo
instance (signature ~ (CLong -> m ()), MonadIO m) => O.MethodInfo DateSetTimeTMethodInfo Date signature where
    overloadedMethod _ = dateSetTimeT

#endif

-- method Date::set_time_val
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDate", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "timeval", argType = TInterface (Name {namespace = "GLib", name = "TimeVal"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#GTimeVal value to set", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_date_set_time_val" g_date_set_time_val ::
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    Ptr GLib.TimeVal.TimeVal ->             -- timeval : TInterface (Name {namespace = "GLib", name = "TimeVal"})
    IO ()

{- |
Sets the value of a date from a 'GI.GLib.Structs.TimeVal.TimeVal' value.  Note that the
/@tvUsec@/ member is ignored, because 'GI.GLib.Structs.Date.Date' can\'t make use of the
additional precision.

The time to date conversion is done using the user\'s current timezone.

/Since: 2.10/
-}
dateSetTimeVal ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date@/: a 'GI.GLib.Structs.Date.Date' -}
    -> GLib.TimeVal.TimeVal
    {- ^ /@timeval@/: 'GI.GLib.Structs.TimeVal.TimeVal' value to set -}
    -> m ()
dateSetTimeVal date timeval = liftIO $ do
    date' <- unsafeManagedPtrGetPtr date
    timeval' <- unsafeManagedPtrGetPtr timeval
    g_date_set_time_val date' timeval'
    touchManagedPtr date
    touchManagedPtr timeval
    return ()

#if ENABLE_OVERLOADING
data DateSetTimeValMethodInfo
instance (signature ~ (GLib.TimeVal.TimeVal -> m ()), MonadIO m) => O.MethodInfo DateSetTimeValMethodInfo Date signature where
    overloadedMethod _ = dateSetTimeVal

#endif

-- method Date::set_year
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDate", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "year", argType = TBasicType TUInt16, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "year to set", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_date_set_year" g_date_set_year ::
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    Word16 ->                               -- year : TBasicType TUInt16
    IO ()

{- |
Sets the year for a 'GI.GLib.Structs.Date.Date'. If the resulting day-month-year
triplet is invalid, the date will be invalid.
-}
dateSetYear ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date@/: a 'GI.GLib.Structs.Date.Date' -}
    -> Word16
    {- ^ /@year@/: year to set -}
    -> m ()
dateSetYear date year = liftIO $ do
    date' <- unsafeManagedPtrGetPtr date
    g_date_set_year date' year
    touchManagedPtr date
    return ()

#if ENABLE_OVERLOADING
data DateSetYearMethodInfo
instance (signature ~ (Word16 -> m ()), MonadIO m) => O.MethodInfo DateSetYearMethodInfo Date signature where
    overloadedMethod _ = dateSetYear

#endif

-- method Date::subtract_days
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDate to decrement", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "n_days", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "number of days to move", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_date_subtract_days" g_date_subtract_days ::
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    Word32 ->                               -- n_days : TBasicType TUInt
    IO ()

{- |
Moves a date some number of days into the past.
To move by weeks, just move by weeks*7 days.
The date must be valid.
-}
dateSubtractDays ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date@/: a 'GI.GLib.Structs.Date.Date' to decrement -}
    -> Word32
    {- ^ /@nDays@/: number of days to move -}
    -> m ()
dateSubtractDays date nDays = liftIO $ do
    date' <- unsafeManagedPtrGetPtr date
    g_date_subtract_days date' nDays
    touchManagedPtr date
    return ()

#if ENABLE_OVERLOADING
data DateSubtractDaysMethodInfo
instance (signature ~ (Word32 -> m ()), MonadIO m) => O.MethodInfo DateSubtractDaysMethodInfo Date signature where
    overloadedMethod _ = dateSubtractDays

#endif

-- method Date::subtract_months
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDate to decrement", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "n_months", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "number of months to move", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_date_subtract_months" g_date_subtract_months ::
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    Word32 ->                               -- n_months : TBasicType TUInt
    IO ()

{- |
Moves a date some number of months into the past.
If the current day of the month doesn\'t exist in
the destination month, the day of the month
may change. The date must be valid.
-}
dateSubtractMonths ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date@/: a 'GI.GLib.Structs.Date.Date' to decrement -}
    -> Word32
    {- ^ /@nMonths@/: number of months to move -}
    -> m ()
dateSubtractMonths date nMonths = liftIO $ do
    date' <- unsafeManagedPtrGetPtr date
    g_date_subtract_months date' nMonths
    touchManagedPtr date
    return ()

#if ENABLE_OVERLOADING
data DateSubtractMonthsMethodInfo
instance (signature ~ (Word32 -> m ()), MonadIO m) => O.MethodInfo DateSubtractMonthsMethodInfo Date signature where
    overloadedMethod _ = dateSubtractMonths

#endif

-- method Date::subtract_years
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDate to decrement", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "n_years", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "number of years to move", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_date_subtract_years" g_date_subtract_years ::
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    Word32 ->                               -- n_years : TBasicType TUInt
    IO ()

{- |
Moves a date some number of years into the past.
If the current day doesn\'t exist in the destination
year (i.e. it\'s February 29 and you move to a non-leap-year)
then the day is changed to February 29. The date
must be valid.
-}
dateSubtractYears ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date@/: a 'GI.GLib.Structs.Date.Date' to decrement -}
    -> Word32
    {- ^ /@nYears@/: number of years to move -}
    -> m ()
dateSubtractYears date nYears = liftIO $ do
    date' <- unsafeManagedPtrGetPtr date
    g_date_subtract_years date' nYears
    touchManagedPtr date
    return ()

#if ENABLE_OVERLOADING
data DateSubtractYearsMethodInfo
instance (signature ~ (Word32 -> m ()), MonadIO m) => O.MethodInfo DateSubtractYearsMethodInfo Date signature where
    overloadedMethod _ = dateSubtractYears

#endif

-- method Date::to_struct_tm
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDate to set the struct tm from", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "tm", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "struct tm to fill", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_date_to_struct_tm" g_date_to_struct_tm ::
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    Ptr () ->                               -- tm : TBasicType TPtr
    IO ()

{- |
Fills in the date-related bits of a struct tm using the /@date@/ value.
Initializes the non-date parts with something sane but meaningless.
-}
dateToStructTm ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date@/: a 'GI.GLib.Structs.Date.Date' to set the struct tm from -}
    -> Ptr ()
    {- ^ /@tm@/: struct tm to fill -}
    -> m ()
dateToStructTm date tm = liftIO $ do
    date' <- unsafeManagedPtrGetPtr date
    g_date_to_struct_tm date' tm
    touchManagedPtr date
    return ()

#if ENABLE_OVERLOADING
data DateToStructTmMethodInfo
instance (signature ~ (Ptr () -> m ()), MonadIO m) => O.MethodInfo DateToStructTmMethodInfo Date signature where
    overloadedMethod _ = dateToStructTm

#endif

-- method Date::valid
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GDate to check", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_date_valid" g_date_valid ::
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    IO CInt

{- |
Returns 'True' if the 'GI.GLib.Structs.Date.Date' represents an existing day. The date must not
contain garbage; it should have been initialized with 'GI.GLib.Structs.Date.dateClear'
if it wasn\'t allocated by one of the 'GI.GLib.Structs.Date.dateNew' variants.
-}
dateValid ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Date
    {- ^ /@date@/: a 'GI.GLib.Structs.Date.Date' to check -}
    -> m Bool
    {- ^ __Returns:__ Whether the date is valid -}
dateValid date = liftIO $ do
    date' <- unsafeManagedPtrGetPtr date
    result <- g_date_valid date'
    let result' = (/= 0) result
    touchManagedPtr date
    return result'

#if ENABLE_OVERLOADING
data DateValidMethodInfo
instance (signature ~ (m Bool), MonadIO m) => O.MethodInfo DateValidMethodInfo Date signature where
    overloadedMethod _ = dateValid

#endif

-- method Date::get_days_in_month
-- method type : MemberFunction
-- Args : [Arg {argCName = "month", argType = TInterface (Name {namespace = "GLib", name = "DateMonth"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "month", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "year", argType = TBasicType TUInt16, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "year", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt8)
-- throws : False
-- Skip return : False

foreign import ccall "g_date_get_days_in_month" g_date_get_days_in_month ::
    CUInt ->                                -- month : TInterface (Name {namespace = "GLib", name = "DateMonth"})
    Word16 ->                               -- year : TBasicType TUInt16
    IO Word8

{- |
Returns the number of days in a month, taking leap
years into account.
-}
dateGetDaysInMonth ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GLib.Enums.DateMonth
    {- ^ /@month@/: month -}
    -> Word16
    {- ^ /@year@/: year -}
    -> m Word8
    {- ^ __Returns:__ number of days in /@month@/ during the /@year@/ -}
dateGetDaysInMonth month year = liftIO $ do
    let month' = (fromIntegral . fromEnum) month
    result <- g_date_get_days_in_month month' year
    return result

#if ENABLE_OVERLOADING
#endif

-- method Date::get_monday_weeks_in_year
-- method type : MemberFunction
-- Args : [Arg {argCName = "year", argType = TBasicType TUInt16, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a year", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt8)
-- throws : False
-- Skip return : False

foreign import ccall "g_date_get_monday_weeks_in_year" g_date_get_monday_weeks_in_year ::
    Word16 ->                               -- year : TBasicType TUInt16
    IO Word8

{- |
Returns the number of weeks in the year, where weeks
are taken to start on Monday. Will be 52 or 53. The
date must be valid. (Years always have 52 7-day periods,
plus 1 or 2 extra days depending on whether it\'s a leap
year. This function is basically telling you how many
Mondays are in the year, i.e. there are 53 Mondays if
one of the extra days happens to be a Monday.)
-}
dateGetMondayWeeksInYear ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word16
    {- ^ /@year@/: a year -}
    -> m Word8
    {- ^ __Returns:__ number of Mondays in the year -}
dateGetMondayWeeksInYear year = liftIO $ do
    result <- g_date_get_monday_weeks_in_year year
    return result

#if ENABLE_OVERLOADING
#endif

-- method Date::get_sunday_weeks_in_year
-- method type : MemberFunction
-- Args : [Arg {argCName = "year", argType = TBasicType TUInt16, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "year to count weeks in", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt8)
-- throws : False
-- Skip return : False

foreign import ccall "g_date_get_sunday_weeks_in_year" g_date_get_sunday_weeks_in_year ::
    Word16 ->                               -- year : TBasicType TUInt16
    IO Word8

{- |
Returns the number of weeks in the year, where weeks
are taken to start on Sunday. Will be 52 or 53. The
date must be valid. (Years always have 52 7-day periods,
plus 1 or 2 extra days depending on whether it\'s a leap
year. This function is basically telling you how many
Sundays are in the year, i.e. there are 53 Sundays if
one of the extra days happens to be a Sunday.)
-}
dateGetSundayWeeksInYear ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word16
    {- ^ /@year@/: year to count weeks in -}
    -> m Word8
    {- ^ __Returns:__ the number of weeks in /@year@/ -}
dateGetSundayWeeksInYear year = liftIO $ do
    result <- g_date_get_sunday_weeks_in_year year
    return result

#if ENABLE_OVERLOADING
#endif

-- method Date::is_leap_year
-- method type : MemberFunction
-- Args : [Arg {argCName = "year", argType = TBasicType TUInt16, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "year to check", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_date_is_leap_year" g_date_is_leap_year ::
    Word16 ->                               -- year : TBasicType TUInt16
    IO CInt

{- |
Returns 'True' if the year is a leap year.

For the purposes of this function, leap year is every year
divisible by 4 unless that year is divisible by 100. If it
is divisible by 100 it would be a leap year only if that year
is also divisible by 400.
-}
dateIsLeapYear ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word16
    {- ^ /@year@/: year to check -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the year is a leap year -}
dateIsLeapYear year = liftIO $ do
    result <- g_date_is_leap_year year
    let result' = (/= 0) result
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Date::strftime
-- method type : MemberFunction
-- Args : [Arg {argCName = "s", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "destination buffer", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "slen", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "buffer size", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "format", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "format string", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "date", argType = TInterface (Name {namespace = "GLib", name = "Date"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "valid #GDate", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt64)
-- throws : False
-- Skip return : False

foreign import ccall "g_date_strftime" g_date_strftime ::
    CString ->                              -- s : TBasicType TUTF8
    Word64 ->                               -- slen : TBasicType TUInt64
    CString ->                              -- format : TBasicType TUTF8
    Ptr Date ->                             -- date : TInterface (Name {namespace = "GLib", name = "Date"})
    IO Word64

{- |
Generates a printed representation of the date, in a
[locale][setlocale]-specific way.
Works just like the platform\'s C library @/strftime()/@ function,
but only accepts date-related formats; time-related formats
give undefined results. Date must be valid. Unlike @/strftime()/@
(which uses the locale encoding), works on a UTF-8 format
string and stores a UTF-8 result.

This function does not provide any conversion specifiers in
addition to those implemented by the platform\'s C library.
For example, don\'t expect that using 'GI.GLib.Functions.dateStrftime' would
make the %F provided by the C99 @/strftime()/@ work on Windows
where the C library only complies to C89.
-}
dateStrftime ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    T.Text
    {- ^ /@s@/: destination buffer -}
    -> Word64
    {- ^ /@slen@/: buffer size -}
    -> T.Text
    {- ^ /@format@/: format string -}
    -> Date
    {- ^ /@date@/: valid 'GI.GLib.Structs.Date.Date' -}
    -> m Word64
    {- ^ __Returns:__ number of characters written to the buffer, or 0 the buffer was too small -}
dateStrftime s slen format date = liftIO $ do
    s' <- textToCString s
    format' <- textToCString format
    date' <- unsafeManagedPtrGetPtr date
    result <- g_date_strftime s' slen format' date'
    touchManagedPtr date
    freeMem s'
    freeMem format'
    return result

#if ENABLE_OVERLOADING
#endif

-- method Date::valid_day
-- method type : MemberFunction
-- Args : [Arg {argCName = "day", argType = TBasicType TUInt8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "day to check", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_date_valid_day" g_date_valid_day ::
    Word8 ->                                -- day : TBasicType TUInt8
    IO CInt

{- |
Returns 'True' if the day of the month is valid (a day is valid if it\'s
between 1 and 31 inclusive).
-}
dateValidDay ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word8
    {- ^ /@day@/: day to check -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the day is valid -}
dateValidDay day = liftIO $ do
    result <- g_date_valid_day day
    let result' = (/= 0) result
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Date::valid_dmy
-- method type : MemberFunction
-- Args : [Arg {argCName = "day", argType = TBasicType TUInt8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "day", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "month", argType = TInterface (Name {namespace = "GLib", name = "DateMonth"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "month", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "year", argType = TBasicType TUInt16, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "year", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_date_valid_dmy" g_date_valid_dmy ::
    Word8 ->                                -- day : TBasicType TUInt8
    CUInt ->                                -- month : TInterface (Name {namespace = "GLib", name = "DateMonth"})
    Word16 ->                               -- year : TBasicType TUInt16
    IO CInt

{- |
Returns 'True' if the day-month-year triplet forms a valid, existing day
in the range of days 'GI.GLib.Structs.Date.Date' understands (Year 1 or later, no more than
a few thousand years in the future).
-}
dateValidDmy ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word8
    {- ^ /@day@/: day -}
    -> GLib.Enums.DateMonth
    {- ^ /@month@/: month -}
    -> Word16
    {- ^ /@year@/: year -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the date is a valid one -}
dateValidDmy day month year = liftIO $ do
    let month' = (fromIntegral . fromEnum) month
    result <- g_date_valid_dmy day month' year
    let result' = (/= 0) result
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Date::valid_julian
-- method type : MemberFunction
-- Args : [Arg {argCName = "julian_date", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "Julian day to check", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_date_valid_julian" g_date_valid_julian ::
    Word32 ->                               -- julian_date : TBasicType TUInt32
    IO CInt

{- |
Returns 'True' if the Julian day is valid. Anything greater than zero
is basically a valid Julian, though there is a 32-bit limit.
-}
dateValidJulian ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word32
    {- ^ /@julianDate@/: Julian day to check -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the Julian day is valid -}
dateValidJulian julianDate = liftIO $ do
    result <- g_date_valid_julian julianDate
    let result' = (/= 0) result
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Date::valid_month
-- method type : MemberFunction
-- Args : [Arg {argCName = "month", argType = TInterface (Name {namespace = "GLib", name = "DateMonth"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "month", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_date_valid_month" g_date_valid_month ::
    CUInt ->                                -- month : TInterface (Name {namespace = "GLib", name = "DateMonth"})
    IO CInt

{- |
Returns 'True' if the month value is valid. The 12 'GI.GLib.Enums.DateMonth'
enumeration values are the only valid months.
-}
dateValidMonth ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GLib.Enums.DateMonth
    {- ^ /@month@/: month -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the month is valid -}
dateValidMonth month = liftIO $ do
    let month' = (fromIntegral . fromEnum) month
    result <- g_date_valid_month month'
    let result' = (/= 0) result
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Date::valid_weekday
-- method type : MemberFunction
-- Args : [Arg {argCName = "weekday", argType = TInterface (Name {namespace = "GLib", name = "DateWeekday"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "weekday", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_date_valid_weekday" g_date_valid_weekday ::
    CUInt ->                                -- weekday : TInterface (Name {namespace = "GLib", name = "DateWeekday"})
    IO CInt

{- |
Returns 'True' if the weekday is valid. The seven 'GI.GLib.Enums.DateWeekday' enumeration
values are the only valid weekdays.
-}
dateValidWeekday ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GLib.Enums.DateWeekday
    {- ^ /@weekday@/: weekday -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the weekday is valid -}
dateValidWeekday weekday = liftIO $ do
    let weekday' = (fromIntegral . fromEnum) weekday
    result <- g_date_valid_weekday weekday'
    let result' = (/= 0) result
    return result'

#if ENABLE_OVERLOADING
#endif

-- method Date::valid_year
-- method type : MemberFunction
-- Args : [Arg {argCName = "year", argType = TBasicType TUInt16, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "year", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "g_date_valid_year" g_date_valid_year ::
    Word16 ->                               -- year : TBasicType TUInt16
    IO CInt

{- |
Returns 'True' if the year is valid. Any year greater than 0 is valid,
though there is a 16-bit limit to what 'GI.GLib.Structs.Date.Date' will understand.
-}
dateValidYear ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Word16
    {- ^ /@year@/: year -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the year is valid -}
dateValidYear year = liftIO $ do
    result <- g_date_valid_year year
    let result' = (/= 0) result
    return result'

#if ENABLE_OVERLOADING
#endif

#if ENABLE_OVERLOADING
type family ResolveDateMethod (t :: Symbol) (o :: *) :: * where
    ResolveDateMethod "addDays" o = DateAddDaysMethodInfo
    ResolveDateMethod "addMonths" o = DateAddMonthsMethodInfo
    ResolveDateMethod "addYears" o = DateAddYearsMethodInfo
    ResolveDateMethod "clamp" o = DateClampMethodInfo
    ResolveDateMethod "clear" o = DateClearMethodInfo
    ResolveDateMethod "compare" o = DateCompareMethodInfo
    ResolveDateMethod "copy" o = DateCopyMethodInfo
    ResolveDateMethod "daysBetween" o = DateDaysBetweenMethodInfo
    ResolveDateMethod "free" o = DateFreeMethodInfo
    ResolveDateMethod "isFirstOfMonth" o = DateIsFirstOfMonthMethodInfo
    ResolveDateMethod "isLastOfMonth" o = DateIsLastOfMonthMethodInfo
    ResolveDateMethod "order" o = DateOrderMethodInfo
    ResolveDateMethod "subtractDays" o = DateSubtractDaysMethodInfo
    ResolveDateMethod "subtractMonths" o = DateSubtractMonthsMethodInfo
    ResolveDateMethod "subtractYears" o = DateSubtractYearsMethodInfo
    ResolveDateMethod "toStructTm" o = DateToStructTmMethodInfo
    ResolveDateMethod "valid" o = DateValidMethodInfo
    ResolveDateMethod "getDay" o = DateGetDayMethodInfo
    ResolveDateMethod "getDayOfYear" o = DateGetDayOfYearMethodInfo
    ResolveDateMethod "getIso8601WeekOfYear" o = DateGetIso8601WeekOfYearMethodInfo
    ResolveDateMethod "getJulian" o = DateGetJulianMethodInfo
    ResolveDateMethod "getMondayWeekOfYear" o = DateGetMondayWeekOfYearMethodInfo
    ResolveDateMethod "getMonth" o = DateGetMonthMethodInfo
    ResolveDateMethod "getSundayWeekOfYear" o = DateGetSundayWeekOfYearMethodInfo
    ResolveDateMethod "getWeekday" o = DateGetWeekdayMethodInfo
    ResolveDateMethod "getYear" o = DateGetYearMethodInfo
    ResolveDateMethod "setDay" o = DateSetDayMethodInfo
    ResolveDateMethod "setDmy" o = DateSetDmyMethodInfo
    ResolveDateMethod "setJulian" o = DateSetJulianMethodInfo
    ResolveDateMethod "setMonth" o = DateSetMonthMethodInfo
    ResolveDateMethod "setParse" o = DateSetParseMethodInfo
    ResolveDateMethod "setTime" o = DateSetTimeMethodInfo
    ResolveDateMethod "setTimeT" o = DateSetTimeTMethodInfo
    ResolveDateMethod "setTimeVal" o = DateSetTimeValMethodInfo
    ResolveDateMethod "setYear" o = DateSetYearMethodInfo
    ResolveDateMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveDateMethod t Date, O.MethodInfo info Date p) => OL.IsLabel t (Date -> 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