// Code generated by "./generator ./session/org.lingmo.pinyin1"; DO NOT EDIT.

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

import (
	"unsafe"

	"github.com/godbus/dbus/v5"
	"github.com/LingmoOS/golang-github-lingmo-go-lib/dbusutil/proxy"
)

type Pinyin interface {
	pinyin // interface org.lingmo.Pinyin1
	proxy.Object
}

type objectPinyin struct {
	interfacePinyin // interface org.lingmo.Pinyin1
	proxy.ImplObject
}

func NewPinyin(conn *dbus.Conn) Pinyin {
	obj := new(objectPinyin)
	obj.ImplObject.Init_(conn, "org.lingmo.Pinyin1", "/org/lingmo/Pinyin1")
	return obj
}

type pinyin interface {
	GoQuery(flags dbus.Flags, ch chan *dbus.Call, hans string) *dbus.Call
	Query(flags dbus.Flags, hans string) ([]string, error)
	GoQueryList(flags dbus.Flags, ch chan *dbus.Call, hansList []string) *dbus.Call
	QueryList(flags dbus.Flags, hansList []string) (string, error)
}

type interfacePinyin struct{}

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

func (*interfacePinyin) GetInterfaceName_() string {
	return "org.lingmo.Pinyin1"
}

// method Query

func (v *interfacePinyin) GoQuery(flags dbus.Flags, ch chan *dbus.Call, hans string) *dbus.Call {
	return v.GetObject_().Go_(v.GetInterfaceName_()+".Query", flags, ch, hans)
}

func (*interfacePinyin) StoreQuery(call *dbus.Call) (pinyin []string, err error) {
	err = call.Store(&pinyin)
	return
}

func (v *interfacePinyin) Query(flags dbus.Flags, hans string) ([]string, error) {
	return v.StoreQuery(
		<-v.GoQuery(flags, make(chan *dbus.Call, 1), hans).Done)
}

// method QueryList

func (v *interfacePinyin) GoQueryList(flags dbus.Flags, ch chan *dbus.Call, hansList []string) *dbus.Call {
	return v.GetObject_().Go_(v.GetInterfaceName_()+".QueryList", flags, ch, hansList)
}

func (*interfacePinyin) StoreQueryList(call *dbus.Call) (json string, err error) {
	err = call.Store(&json)
	return
}

func (v *interfacePinyin) QueryList(flags dbus.Flags, hansList []string) (string, error) {
	return v.StoreQueryList(
		<-v.GoQueryList(flags, make(chan *dbus.Call, 1), hansList).Done)
}
