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

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

import (
	"errors"
	"unsafe"

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

type Agent interface {
	agent // interface org.deepin.dde.Bluetooth1.Agent
	proxy.Object
}

type objectAgent struct {
	interfaceAgent // interface org.deepin.dde.Bluetooth1.Agent
	proxy.ImplObject
}

func NewAgent(conn *dbus.Conn, serviceName string, path dbus.ObjectPath) (Agent, error) {
	if !path.IsValid() {
		return nil, errors.New("path is invalid")
	}
	obj := new(objectAgent)
	obj.ImplObject.Init_(conn, serviceName, path)
	return obj, nil
}

type agent interface {
	GoAuthorizeService(flags dbus.Flags, ch chan *dbus.Call, device dbus.ObjectPath, uuid string) *dbus.Call
	AuthorizeService(flags dbus.Flags, device dbus.ObjectPath, uuid string) error
	GoCancel(flags dbus.Flags, ch chan *dbus.Call) *dbus.Call
	Cancel(flags dbus.Flags) error
	GoDisplayPasskey(flags dbus.Flags, ch chan *dbus.Call, device dbus.ObjectPath, passkey uint32, entered uint16) *dbus.Call
	DisplayPasskey(flags dbus.Flags, device dbus.ObjectPath, passkey uint32, entered uint16) error
	GoDisplayPinCode(flags dbus.Flags, ch chan *dbus.Call, device dbus.ObjectPath, pinCode string) *dbus.Call
	DisplayPinCode(flags dbus.Flags, device dbus.ObjectPath, pinCode string) error
	GoRelease(flags dbus.Flags, ch chan *dbus.Call) *dbus.Call
	Release(flags dbus.Flags) error
	GoRequestAuthorization(flags dbus.Flags, ch chan *dbus.Call, device dbus.ObjectPath) *dbus.Call
	RequestAuthorization(flags dbus.Flags, device dbus.ObjectPath) error
	GoRequestConfirmation(flags dbus.Flags, ch chan *dbus.Call, device dbus.ObjectPath, passkey uint32) *dbus.Call
	RequestConfirmation(flags dbus.Flags, device dbus.ObjectPath, passkey uint32) error
	GoRequestPasskey(flags dbus.Flags, ch chan *dbus.Call, device dbus.ObjectPath) *dbus.Call
	RequestPasskey(flags dbus.Flags, device dbus.ObjectPath) (uint32, error)
	GoRequestPinCode(flags dbus.Flags, ch chan *dbus.Call, device dbus.ObjectPath) *dbus.Call
	RequestPinCode(flags dbus.Flags, device dbus.ObjectPath) (string, error)
	GoSendNotify(flags dbus.Flags, ch chan *dbus.Call, arg string) *dbus.Call
	SendNotify(flags dbus.Flags, arg string) error
}

type interfaceAgent struct{}

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

func (*interfaceAgent) GetInterfaceName_() string {
	return "org.deepin.dde.Bluetooth1.Agent"
}

// method AuthorizeService

func (v *interfaceAgent) GoAuthorizeService(flags dbus.Flags, ch chan *dbus.Call, device dbus.ObjectPath, uuid string) *dbus.Call {
	return v.GetObject_().Go_(v.GetInterfaceName_()+".AuthorizeService", flags, ch, device, uuid)
}

func (v *interfaceAgent) AuthorizeService(flags dbus.Flags, device dbus.ObjectPath, uuid string) error {
	return (<-v.GoAuthorizeService(flags, make(chan *dbus.Call, 1), device, uuid).Done).Err
}

// method Cancel

func (v *interfaceAgent) GoCancel(flags dbus.Flags, ch chan *dbus.Call) *dbus.Call {
	return v.GetObject_().Go_(v.GetInterfaceName_()+".Cancel", flags, ch)
}

func (v *interfaceAgent) Cancel(flags dbus.Flags) error {
	return (<-v.GoCancel(flags, make(chan *dbus.Call, 1)).Done).Err
}

// method DisplayPasskey

func (v *interfaceAgent) GoDisplayPasskey(flags dbus.Flags, ch chan *dbus.Call, device dbus.ObjectPath, passkey uint32, entered uint16) *dbus.Call {
	return v.GetObject_().Go_(v.GetInterfaceName_()+".DisplayPasskey", flags, ch, device, passkey, entered)
}

func (v *interfaceAgent) DisplayPasskey(flags dbus.Flags, device dbus.ObjectPath, passkey uint32, entered uint16) error {
	return (<-v.GoDisplayPasskey(flags, make(chan *dbus.Call, 1), device, passkey, entered).Done).Err
}

// method DisplayPinCode

func (v *interfaceAgent) GoDisplayPinCode(flags dbus.Flags, ch chan *dbus.Call, device dbus.ObjectPath, pinCode string) *dbus.Call {
	return v.GetObject_().Go_(v.GetInterfaceName_()+".DisplayPinCode", flags, ch, device, pinCode)
}

func (v *interfaceAgent) DisplayPinCode(flags dbus.Flags, device dbus.ObjectPath, pinCode string) error {
	return (<-v.GoDisplayPinCode(flags, make(chan *dbus.Call, 1), device, pinCode).Done).Err
}

// method Release

func (v *interfaceAgent) GoRelease(flags dbus.Flags, ch chan *dbus.Call) *dbus.Call {
	return v.GetObject_().Go_(v.GetInterfaceName_()+".Release", flags, ch)
}

func (v *interfaceAgent) Release(flags dbus.Flags) error {
	return (<-v.GoRelease(flags, make(chan *dbus.Call, 1)).Done).Err
}

// method RequestAuthorization

func (v *interfaceAgent) GoRequestAuthorization(flags dbus.Flags, ch chan *dbus.Call, device dbus.ObjectPath) *dbus.Call {
	return v.GetObject_().Go_(v.GetInterfaceName_()+".RequestAuthorization", flags, ch, device)
}

func (v *interfaceAgent) RequestAuthorization(flags dbus.Flags, device dbus.ObjectPath) error {
	return (<-v.GoRequestAuthorization(flags, make(chan *dbus.Call, 1), device).Done).Err
}

// method RequestConfirmation

func (v *interfaceAgent) GoRequestConfirmation(flags dbus.Flags, ch chan *dbus.Call, device dbus.ObjectPath, passkey uint32) *dbus.Call {
	return v.GetObject_().Go_(v.GetInterfaceName_()+".RequestConfirmation", flags, ch, device, passkey)
}

func (v *interfaceAgent) RequestConfirmation(flags dbus.Flags, device dbus.ObjectPath, passkey uint32) error {
	return (<-v.GoRequestConfirmation(flags, make(chan *dbus.Call, 1), device, passkey).Done).Err
}

// method RequestPasskey

func (v *interfaceAgent) GoRequestPasskey(flags dbus.Flags, ch chan *dbus.Call, device dbus.ObjectPath) *dbus.Call {
	return v.GetObject_().Go_(v.GetInterfaceName_()+".RequestPasskey", flags, ch, device)
}

func (*interfaceAgent) StoreRequestPasskey(call *dbus.Call) (passkey uint32, err error) {
	err = call.Store(&passkey)
	return
}

func (v *interfaceAgent) RequestPasskey(flags dbus.Flags, device dbus.ObjectPath) (uint32, error) {
	return v.StoreRequestPasskey(
		<-v.GoRequestPasskey(flags, make(chan *dbus.Call, 1), device).Done)
}

// method RequestPinCode

func (v *interfaceAgent) GoRequestPinCode(flags dbus.Flags, ch chan *dbus.Call, device dbus.ObjectPath) *dbus.Call {
	return v.GetObject_().Go_(v.GetInterfaceName_()+".RequestPinCode", flags, ch, device)
}

func (*interfaceAgent) StoreRequestPinCode(call *dbus.Call) (pinCode string, err error) {
	err = call.Store(&pinCode)
	return
}

func (v *interfaceAgent) RequestPinCode(flags dbus.Flags, device dbus.ObjectPath) (string, error) {
	return v.StoreRequestPinCode(
		<-v.GoRequestPinCode(flags, make(chan *dbus.Call, 1), device).Done)
}

// method SendNotify

func (v *interfaceAgent) GoSendNotify(flags dbus.Flags, ch chan *dbus.Call, arg string) *dbus.Call {
	return v.GetObject_().Go_(v.GetInterfaceName_()+".SendNotify", flags, ch, arg)
}

func (v *interfaceAgent) SendNotify(flags dbus.Flags, arg string) error {
	return (<-v.GoSendNotify(flags, make(chan *dbus.Call, 1), arg).Done).Err
}
