// Code generated by "./generator ./system/org.deepin.dde.powermanager1"; DO NOT EDIT.

// SPDX-FileCopyrightText: 2018 - 2023 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later
package powermanager1

import (
	"unsafe"

	"github.com/godbus/dbus/v5"
	"github.com/linuxdeepin/go-lib/dbusutil/proxy"
)

type PowerManager interface {
	powerManager // interface org.deepin.dde.PowerManager1
	proxy.Object
}

type objectPowerManager struct {
	interfacePowerManager // interface org.deepin.dde.PowerManager1
	proxy.ImplObject
}

func NewPowerManager(conn *dbus.Conn) PowerManager {
	obj := new(objectPowerManager)
	obj.ImplObject.Init_(conn, "org.deepin.dde.PowerManager1", "/org/deepin/dde/PowerManager1")
	return obj
}

type powerManager interface {
	GoCanShutdown(flags dbus.Flags, ch chan *dbus.Call) *dbus.Call
	CanShutdown(flags dbus.Flags) (bool, error)
	GoCanReboot(flags dbus.Flags, ch chan *dbus.Call) *dbus.Call
	CanReboot(flags dbus.Flags) (bool, error)
	GoCanSuspend(flags dbus.Flags, ch chan *dbus.Call) *dbus.Call
	CanSuspend(flags dbus.Flags) (bool, error)
	GoCanHibernate(flags dbus.Flags, ch chan *dbus.Call) *dbus.Call
	CanHibernate(flags dbus.Flags) (bool, error)
}

type interfacePowerManager struct{}

func (v *interfacePowerManager) GetObject_() *proxy.ImplObject {
	return (*proxy.ImplObject)(unsafe.Pointer(v))
}

func (*interfacePowerManager) GetInterfaceName_() string {
	return "org.deepin.dde.PowerManager1"
}

// method CanShutdown

func (v *interfacePowerManager) GoCanShutdown(flags dbus.Flags, ch chan *dbus.Call) *dbus.Call {
	return v.GetObject_().Go_(v.GetInterfaceName_()+".CanShutdown", flags, ch)
}

func (*interfacePowerManager) StoreCanShutdown(call *dbus.Call) (can bool, err error) {
	err = call.Store(&can)
	return
}

func (v *interfacePowerManager) CanShutdown(flags dbus.Flags) (bool, error) {
	return v.StoreCanShutdown(
		<-v.GoCanShutdown(flags, make(chan *dbus.Call, 1)).Done)
}

// method CanReboot

func (v *interfacePowerManager) GoCanReboot(flags dbus.Flags, ch chan *dbus.Call) *dbus.Call {
	return v.GetObject_().Go_(v.GetInterfaceName_()+".CanReboot", flags, ch)
}

func (*interfacePowerManager) StoreCanReboot(call *dbus.Call) (can bool, err error) {
	err = call.Store(&can)
	return
}

func (v *interfacePowerManager) CanReboot(flags dbus.Flags) (bool, error) {
	return v.StoreCanReboot(
		<-v.GoCanReboot(flags, make(chan *dbus.Call, 1)).Done)
}

// method CanSuspend

func (v *interfacePowerManager) GoCanSuspend(flags dbus.Flags, ch chan *dbus.Call) *dbus.Call {
	return v.GetObject_().Go_(v.GetInterfaceName_()+".CanSuspend", flags, ch)
}

func (*interfacePowerManager) StoreCanSuspend(call *dbus.Call) (can bool, err error) {
	err = call.Store(&can)
	return
}

func (v *interfacePowerManager) CanSuspend(flags dbus.Flags) (bool, error) {
	return v.StoreCanSuspend(
		<-v.GoCanSuspend(flags, make(chan *dbus.Call, 1)).Done)
}

// method CanHibernate

func (v *interfacePowerManager) GoCanHibernate(flags dbus.Flags, ch chan *dbus.Call) *dbus.Call {
	return v.GetObject_().Go_(v.GetInterfaceName_()+".CanHibernate", flags, ch)
}

func (*interfacePowerManager) StoreCanHibernate(call *dbus.Call) (can bool, err error) {
	err = call.Store(&can)
	return
}

func (v *interfacePowerManager) CanHibernate(flags dbus.Flags) (bool, error) {
	return v.StoreCanHibernate(
		<-v.GoCanHibernate(flags, make(chan *dbus.Call, 1)).Done)
}
