// Code generated by "./generator ./discard/org.freedesktop.miracle.wfd"; DO NOT EDIT.

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

import (
	"errors"
	"unsafe"

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

type Wfd interface {
	ObjectManager() object_manager.ObjectManager // interface org.freedesktop.DBus.ObjectManager
	Wfd() wfd                                    // interface org.freedesktop.miracle.wfd
	proxy.Object
}

type objectWfd struct {
	object_manager.InterfaceObjectManager // interface org.freedesktop.DBus.ObjectManager
	interfaceWfd                          // interface org.freedesktop.miracle.wfd
	proxy.ImplObject
}

func NewWfd(conn *dbus.Conn) Wfd {
	obj := new(objectWfd)
	obj.ImplObject.Init_(conn, "org.freedesktop.miracle.wfd", "/org/freedesktop/miracle/wfd")
	return obj
}

func (obj *objectWfd) ObjectManager() object_manager.ObjectManager {
	return &obj.InterfaceObjectManager
}

func (obj *objectWfd) Wfd() wfd {
	return &obj.interfaceWfd
}

type wfd interface {
	GoShutdown(flags dbus.Flags, ch chan *dbus.Call) *dbus.Call
	Shutdown(flags dbus.Flags) error
}

type interfaceWfd struct{}

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

func (*interfaceWfd) GetInterfaceName_() string {
	return "org.freedesktop.miracle.wfd"
}

// method Shutdown

func (v *interfaceWfd) GoShutdown(flags dbus.Flags, ch chan *dbus.Call) *dbus.Call {
	return v.GetObject_().Go_(v.GetInterfaceName_()+".Shutdown", flags, ch)
}

func (v *interfaceWfd) Shutdown(flags dbus.Flags) error {
	return (<-v.GoShutdown(flags, make(chan *dbus.Call, 1)).Done).Err
}

type Sink interface {
	sink // interface org.freedesktop.miracle.wfd.Sink
	proxy.Object
}

type objectSink struct {
	interfaceSink // interface org.freedesktop.miracle.wfd.Sink
	proxy.ImplObject
}

func NewSink(conn *dbus.Conn, path dbus.ObjectPath) (Sink, error) {
	if !path.IsValid() {
		return nil, errors.New("path is invalid")
	}
	obj := new(objectSink)
	obj.ImplObject.Init_(conn, "org.freedesktop.miracle.wfd", path)
	return obj, nil
}

type sink interface {
	GoStartSession(flags dbus.Flags, ch chan *dbus.Call, arg0 string, arg1 string, arg2 uint32, arg3 uint32, arg4 uint32, arg5 uint32, arg6 string) *dbus.Call
	StartSession(flags dbus.Flags, arg0 string, arg1 string, arg2 uint32, arg3 uint32, arg4 uint32, arg5 uint32, arg6 string) (dbus.ObjectPath, error)
	Session() proxy.PropObjectPath
	Peer() proxy.PropObjectPath
}

type interfaceSink struct{}

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

func (*interfaceSink) GetInterfaceName_() string {
	return "org.freedesktop.miracle.wfd.Sink"
}

// method StartSession

func (v *interfaceSink) GoStartSession(flags dbus.Flags, ch chan *dbus.Call, arg0 string, arg1 string, arg2 uint32, arg3 uint32, arg4 uint32, arg5 uint32, arg6 string) *dbus.Call {
	return v.GetObject_().Go_(v.GetInterfaceName_()+".StartSession", flags, ch, arg0, arg1, arg2, arg3, arg4, arg5, arg6)
}

func (*interfaceSink) StoreStartSession(call *dbus.Call) (arg7 dbus.ObjectPath, err error) {
	err = call.Store(&arg7)
	return
}

func (v *interfaceSink) StartSession(flags dbus.Flags, arg0 string, arg1 string, arg2 uint32, arg3 uint32, arg4 uint32, arg5 uint32, arg6 string) (dbus.ObjectPath, error) {
	return v.StoreStartSession(
		<-v.GoStartSession(flags, make(chan *dbus.Call, 1), arg0, arg1, arg2, arg3, arg4, arg5, arg6).Done)
}

// property Session o

func (v *interfaceSink) Session() proxy.PropObjectPath {
	return &proxy.ImplPropObjectPath{
		Impl: v,
		Name: "Session",
	}
}

// property Peer o

func (v *interfaceSink) Peer() proxy.PropObjectPath {
	return &proxy.ImplPropObjectPath{
		Impl: v,
		Name: "Peer",
	}
}

type Session interface {
	session // interface org.freedesktop.miracle.wfd.Session
	proxy.Object
}

type objectSession struct {
	interfaceSession // interface org.freedesktop.miracle.wfd.Session
	proxy.ImplObject
}

func NewSession(conn *dbus.Conn, path dbus.ObjectPath) (Session, error) {
	if !path.IsValid() {
		return nil, errors.New("path is invalid")
	}
	obj := new(objectSession)
	obj.ImplObject.Init_(conn, "org.freedesktop.miracle.wfd", path)
	return obj, nil
}

type session interface {
	GoResume(flags dbus.Flags, ch chan *dbus.Call) *dbus.Call
	Resume(flags dbus.Flags) error
	GoPause(flags dbus.Flags, ch chan *dbus.Call) *dbus.Call
	Pause(flags dbus.Flags) error
	GoTeardown(flags dbus.Flags, ch chan *dbus.Call) *dbus.Call
	Teardown(flags dbus.Flags) error
	Sink() proxy.PropObjectPath
	Url() proxy.PropString
	State() proxy.PropInt32
}

type interfaceSession struct{}

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

func (*interfaceSession) GetInterfaceName_() string {
	return "org.freedesktop.miracle.wfd.Session"
}

// method Resume

func (v *interfaceSession) GoResume(flags dbus.Flags, ch chan *dbus.Call) *dbus.Call {
	return v.GetObject_().Go_(v.GetInterfaceName_()+".Resume", flags, ch)
}

func (v *interfaceSession) Resume(flags dbus.Flags) error {
	return (<-v.GoResume(flags, make(chan *dbus.Call, 1)).Done).Err
}

// method Pause

func (v *interfaceSession) GoPause(flags dbus.Flags, ch chan *dbus.Call) *dbus.Call {
	return v.GetObject_().Go_(v.GetInterfaceName_()+".Pause", flags, ch)
}

func (v *interfaceSession) Pause(flags dbus.Flags) error {
	return (<-v.GoPause(flags, make(chan *dbus.Call, 1)).Done).Err
}

// method Teardown

func (v *interfaceSession) GoTeardown(flags dbus.Flags, ch chan *dbus.Call) *dbus.Call {
	return v.GetObject_().Go_(v.GetInterfaceName_()+".Teardown", flags, ch)
}

func (v *interfaceSession) Teardown(flags dbus.Flags) error {
	return (<-v.GoTeardown(flags, make(chan *dbus.Call, 1)).Done).Err
}

// property Sink o

func (v *interfaceSession) Sink() proxy.PropObjectPath {
	return &proxy.ImplPropObjectPath{
		Impl: v,
		Name: "Sink",
	}
}

// property Url s

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

// property State i

func (v *interfaceSession) State() proxy.PropInt32 {
	return &proxy.ImplPropInt32{
		Impl: v,
		Name: "State",
	}
}
