// Code generated by "./generator ./com.deepin.dde.ControlCenter"; DO NOT EDIT.

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

import (
	"errors"
	"fmt"
	"unsafe"

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

type ControlCenter interface {
	controlCenter // interface com.deepin.dde.ControlCenter
	proxy.Object
}

type objectControlCenter struct {
	interfaceControlCenter // interface com.deepin.dde.ControlCenter
	proxy.ImplObject
}

func NewControlCenter(conn *dbus.Conn) ControlCenter {
	obj := new(objectControlCenter)
	obj.ImplObject.Init_(conn, "com.deepin.dde.ControlCenter", "/com/deepin/dde/ControlCenter")
	return obj
}

type controlCenter interface {
	GoExitProc(flags dbus.Flags, ch chan *dbus.Call) *dbus.Call
	ExitProc(flags dbus.Flags) error
	GoHide(flags dbus.Flags, ch chan *dbus.Call) *dbus.Call
	Hide(flags dbus.Flags) error
	GoHideImmediately(flags dbus.Flags, ch chan *dbus.Call) *dbus.Call
	HideImmediately(flags dbus.Flags) error
	GoShow(flags dbus.Flags, ch chan *dbus.Call) *dbus.Call
	Show(flags dbus.Flags) error
	GoShowImmediately(flags dbus.Flags, ch chan *dbus.Call) *dbus.Call
	ShowImmediately(flags dbus.Flags) error
	GoShowHome(flags dbus.Flags, ch chan *dbus.Call) *dbus.Call
	ShowHome(flags dbus.Flags) error
	GoShowModule(flags dbus.Flags, ch chan *dbus.Call, module string) *dbus.Call
	ShowModule(flags dbus.Flags, module string) error
	GoShowPage(flags dbus.Flags, ch chan *dbus.Call, module string, page string) *dbus.Call
	ShowPage(flags dbus.Flags, module string, page string) error
	GoToggle(flags dbus.Flags, ch chan *dbus.Call) *dbus.Call
	Toggle(flags dbus.Flags) error
	GoToggleInLeft(flags dbus.Flags, ch chan *dbus.Call) *dbus.Call
	ToggleInLeft(flags dbus.Flags) error
	GoIsNetworkCanShowPassword(flags dbus.Flags, ch chan *dbus.Call) *dbus.Call
	IsNetworkCanShowPassword(flags dbus.Flags) (bool, error)
	GoIsModuleAvailable(flags dbus.Flags, ch chan *dbus.Call, arg1 string) *dbus.Call
	IsModuleAvailable(flags dbus.Flags, arg1 string) (bool, error)
	ConnectRectChanged(cb func(rect []interface{})) (dbusutil.SignalHandlerId, error)
	ConnectDestRectChanged(cb func(rect []interface{})) (dbusutil.SignalHandlerId, error)
	ShowInRight() proxy.PropBool
	CurrentModule() proxy.PropString
}

type interfaceControlCenter struct{}

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

func (*interfaceControlCenter) GetInterfaceName_() string {
	return "com.deepin.dde.ControlCenter"
}

// method exitProc

func (v *interfaceControlCenter) GoExitProc(flags dbus.Flags, ch chan *dbus.Call) *dbus.Call {
	return v.GetObject_().Go_(v.GetInterfaceName_()+".exitProc", flags, ch)
}

func (v *interfaceControlCenter) ExitProc(flags dbus.Flags) error {
	return (<-v.GoExitProc(flags, make(chan *dbus.Call, 1)).Done).Err
}

// method Hide

func (v *interfaceControlCenter) GoHide(flags dbus.Flags, ch chan *dbus.Call) *dbus.Call {
	return v.GetObject_().Go_(v.GetInterfaceName_()+".Hide", flags, ch)
}

func (v *interfaceControlCenter) Hide(flags dbus.Flags) error {
	return (<-v.GoHide(flags, make(chan *dbus.Call, 1)).Done).Err
}

// method HideImmediately

func (v *interfaceControlCenter) GoHideImmediately(flags dbus.Flags, ch chan *dbus.Call) *dbus.Call {
	return v.GetObject_().Go_(v.GetInterfaceName_()+".HideImmediately", flags, ch)
}

func (v *interfaceControlCenter) HideImmediately(flags dbus.Flags) error {
	return (<-v.GoHideImmediately(flags, make(chan *dbus.Call, 1)).Done).Err
}

// method Show

func (v *interfaceControlCenter) GoShow(flags dbus.Flags, ch chan *dbus.Call) *dbus.Call {
	return v.GetObject_().Go_(v.GetInterfaceName_()+".Show", flags, ch)
}

func (v *interfaceControlCenter) Show(flags dbus.Flags) error {
	return (<-v.GoShow(flags, make(chan *dbus.Call, 1)).Done).Err
}

// method ShowImmediately

func (v *interfaceControlCenter) GoShowImmediately(flags dbus.Flags, ch chan *dbus.Call) *dbus.Call {
	return v.GetObject_().Go_(v.GetInterfaceName_()+".ShowImmediately", flags, ch)
}

func (v *interfaceControlCenter) ShowImmediately(flags dbus.Flags) error {
	return (<-v.GoShowImmediately(flags, make(chan *dbus.Call, 1)).Done).Err
}

// method ShowHome

func (v *interfaceControlCenter) GoShowHome(flags dbus.Flags, ch chan *dbus.Call) *dbus.Call {
	return v.GetObject_().Go_(v.GetInterfaceName_()+".ShowHome", flags, ch)
}

func (v *interfaceControlCenter) ShowHome(flags dbus.Flags) error {
	return (<-v.GoShowHome(flags, make(chan *dbus.Call, 1)).Done).Err
}

// method ShowModule

func (v *interfaceControlCenter) GoShowModule(flags dbus.Flags, ch chan *dbus.Call, module string) *dbus.Call {
	return v.GetObject_().Go_(v.GetInterfaceName_()+".ShowModule", flags, ch, module)
}

func (v *interfaceControlCenter) ShowModule(flags dbus.Flags, module string) error {
	return (<-v.GoShowModule(flags, make(chan *dbus.Call, 1), module).Done).Err
}

// method ShowPage

func (v *interfaceControlCenter) GoShowPage(flags dbus.Flags, ch chan *dbus.Call, module string, page string) *dbus.Call {
	return v.GetObject_().Go_(v.GetInterfaceName_()+".ShowPage", flags, ch, module, page)
}

func (v *interfaceControlCenter) ShowPage(flags dbus.Flags, module string, page string) error {
	return (<-v.GoShowPage(flags, make(chan *dbus.Call, 1), module, page).Done).Err
}

// method Toggle

func (v *interfaceControlCenter) GoToggle(flags dbus.Flags, ch chan *dbus.Call) *dbus.Call {
	return v.GetObject_().Go_(v.GetInterfaceName_()+".Toggle", flags, ch)
}

func (v *interfaceControlCenter) Toggle(flags dbus.Flags) error {
	return (<-v.GoToggle(flags, make(chan *dbus.Call, 1)).Done).Err
}

// method ToggleInLeft

func (v *interfaceControlCenter) GoToggleInLeft(flags dbus.Flags, ch chan *dbus.Call) *dbus.Call {
	return v.GetObject_().Go_(v.GetInterfaceName_()+".ToggleInLeft", flags, ch)
}

func (v *interfaceControlCenter) ToggleInLeft(flags dbus.Flags) error {
	return (<-v.GoToggleInLeft(flags, make(chan *dbus.Call, 1)).Done).Err
}

// method isNetworkCanShowPassword

func (v *interfaceControlCenter) GoIsNetworkCanShowPassword(flags dbus.Flags, ch chan *dbus.Call) *dbus.Call {
	return v.GetObject_().Go_(v.GetInterfaceName_()+".isNetworkCanShowPassword", flags, ch)
}

func (*interfaceControlCenter) StoreIsNetworkCanShowPassword(call *dbus.Call) (arg0 bool, err error) {
	err = call.Store(&arg0)
	return
}

func (v *interfaceControlCenter) IsNetworkCanShowPassword(flags dbus.Flags) (bool, error) {
	return v.StoreIsNetworkCanShowPassword(
		<-v.GoIsNetworkCanShowPassword(flags, make(chan *dbus.Call, 1)).Done)
}

// method isModuleAvailable

func (v *interfaceControlCenter) GoIsModuleAvailable(flags dbus.Flags, ch chan *dbus.Call, arg1 string) *dbus.Call {
	return v.GetObject_().Go_(v.GetInterfaceName_()+".isModuleAvailable", flags, ch, arg1)
}

func (*interfaceControlCenter) StoreIsModuleAvailable(call *dbus.Call) (arg0 bool, err error) {
	err = call.Store(&arg0)
	return
}

func (v *interfaceControlCenter) IsModuleAvailable(flags dbus.Flags, arg1 string) (bool, error) {
	return v.StoreIsModuleAvailable(
		<-v.GoIsModuleAvailable(flags, make(chan *dbus.Call, 1), arg1).Done)
}

// signal rectChanged

func (v *interfaceControlCenter) ConnectRectChanged(cb func(rect []interface{})) (dbusutil.SignalHandlerId, error) {
	if cb == nil {
		return 0, errors.New("nil callback")
	}
	obj := v.GetObject_()
	rule := fmt.Sprintf(
		"type='signal',interface='%s',member='%s',path='%s',sender='%s'",
		v.GetInterfaceName_(), "rectChanged", obj.Path_(), obj.ServiceName_())

	sigRule := &dbusutil.SignalRule{
		Path: obj.Path_(),
		Name: v.GetInterfaceName_() + ".rectChanged",
	}
	handlerFunc := func(sig *dbus.Signal) {
		var rect []interface{}
		err := dbus.Store(sig.Body, &rect)
		if err == nil {
			cb(rect)
		}
	}

	return obj.ConnectSignal_(rule, sigRule, handlerFunc)
}

// signal destRectChanged

func (v *interfaceControlCenter) ConnectDestRectChanged(cb func(rect []interface{})) (dbusutil.SignalHandlerId, error) {
	if cb == nil {
		return 0, errors.New("nil callback")
	}
	obj := v.GetObject_()
	rule := fmt.Sprintf(
		"type='signal',interface='%s',member='%s',path='%s',sender='%s'",
		v.GetInterfaceName_(), "destRectChanged", obj.Path_(), obj.ServiceName_())

	sigRule := &dbusutil.SignalRule{
		Path: obj.Path_(),
		Name: v.GetInterfaceName_() + ".destRectChanged",
	}
	handlerFunc := func(sig *dbus.Signal) {
		var rect []interface{}
		err := dbus.Store(sig.Body, &rect)
		if err == nil {
			cb(rect)
		}
	}

	return obj.ConnectSignal_(rule, sigRule, handlerFunc)
}

// property ShowInRight b

func (v *interfaceControlCenter) ShowInRight() proxy.PropBool {
	return &proxy.ImplPropBool{
		Impl: v,
		Name: "ShowInRight",
	}
}

// property CurrentModule s

func (v *interfaceControlCenter) CurrentModule() proxy.PropString {
	return &proxy.ImplPropString{
		Impl: v,
		Name: "CurrentModule",
	}
}
