// Code generated by "./generator ./com.deepin.daemon.powermanager"; DO NOT EDIT.

// Copyright: 2018 - 2022 UnionTech Software Technology Co., Ltd.
//
// License-Identifier: GPL-3.0-or-later
package powermanager

import (
	"unsafe"

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

type PowerManager interface {
	powerManager // interface com.deepin.daemon.PowerManager
	proxy.Object
}

type objectPowerManager struct {
	interfacePowerManager // interface com.deepin.daemon.PowerManager
	proxy.ImplObject
}

func NewPowerManager(conn *dbus.Conn) PowerManager {
	obj := new(objectPowerManager)
	obj.ImplObject.Init_(conn, "com.deepin.daemon.PowerManager", "/com/deepin/daemon/PowerManager")
	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)
	GoFastbootShutdown(flags dbus.Flags, ch chan *dbus.Call) *dbus.Call
	FastbootShutdown(flags dbus.Flags) error
	GoFastbootShutdownSetup(flags dbus.Flags, ch chan *dbus.Call, state string) *dbus.Call
	FastbootShutdownSetup(flags dbus.Flags, state string) error
}

type interfacePowerManager struct{}

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

func (*interfacePowerManager) GetInterfaceName_() string {
	return "com.deepin.daemon.PowerManager"
}

// 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)
}

// method FastbootShutdown

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

func (v *interfacePowerManager) FastbootShutdown(flags dbus.Flags) error {
	return (<-v.GoFastbootShutdown(flags, make(chan *dbus.Call, 1)).Done).Err
}

// method FastbootShutdownSetup

func (v *interfacePowerManager) GoFastbootShutdownSetup(flags dbus.Flags, ch chan *dbus.Call, state string) *dbus.Call {
	return v.GetObject_().Go_(v.GetInterfaceName_()+".FastbootShutdownSetup", flags, ch, state)
}

func (v *interfacePowerManager) FastbootShutdownSetup(flags dbus.Flags, state string) error {
	return (<-v.GoFastbootShutdownSetup(flags, make(chan *dbus.Call, 1), state).Done).Err
}
