// Code generated by winrt-go-gen. DO NOT EDIT.

//go:build windows

//nolint:all
package genericattributeprofile

import (
	"syscall"
	"unsafe"

	"git.savin.nyc/alex/go-winrt/windows/devices/bluetooth"
	"github.com/go-ole/go-ole"
)

const SignatureGattLocalCharacteristicResult string = "rc(Windows.Devices.Bluetooth.GenericAttributeProfile.GattLocalCharacteristicResult;{7975de9b-0170-4397-9666-92f863f12ee6})"

type GattLocalCharacteristicResult struct {
	ole.IUnknown
}

func (impl *GattLocalCharacteristicResult) GetCharacteristic() (*GattLocalCharacteristic, error) {
	itf := impl.MustQueryInterface(ole.NewGUID(GUIDiGattLocalCharacteristicResult))
	defer itf.Release()
	v := (*iGattLocalCharacteristicResult)(unsafe.Pointer(itf))
	return v.GetCharacteristic()
}

func (impl *GattLocalCharacteristicResult) GetError() (bluetooth.BluetoothError, error) {
	itf := impl.MustQueryInterface(ole.NewGUID(GUIDiGattLocalCharacteristicResult))
	defer itf.Release()
	v := (*iGattLocalCharacteristicResult)(unsafe.Pointer(itf))
	return v.GetError()
}

const GUIDiGattLocalCharacteristicResult string = "7975de9b-0170-4397-9666-92f863f12ee6"
const SignatureiGattLocalCharacteristicResult string = "{7975de9b-0170-4397-9666-92f863f12ee6}"

type iGattLocalCharacteristicResult struct {
	ole.IInspectable
}

type iGattLocalCharacteristicResultVtbl struct {
	ole.IInspectableVtbl

	GetCharacteristic uintptr
	GetError          uintptr
}

func (v *iGattLocalCharacteristicResult) VTable() *iGattLocalCharacteristicResultVtbl {
	return (*iGattLocalCharacteristicResultVtbl)(unsafe.Pointer(v.RawVTable))
}

func (v *iGattLocalCharacteristicResult) GetCharacteristic() (*GattLocalCharacteristic, error) {
	var out *GattLocalCharacteristic
	hr, _, _ := syscall.SyscallN(
		v.VTable().GetCharacteristic,
		uintptr(unsafe.Pointer(v)),    // this
		uintptr(unsafe.Pointer(&out)), // out GattLocalCharacteristic
	)

	if hr != 0 {
		return nil, ole.NewError(hr)
	}

	return out, nil
}

func (v *iGattLocalCharacteristicResult) GetError() (bluetooth.BluetoothError, error) {
	var out bluetooth.BluetoothError
	hr, _, _ := syscall.SyscallN(
		v.VTable().GetError,
		uintptr(unsafe.Pointer(v)),    // this
		uintptr(unsafe.Pointer(&out)), // out bluetooth.BluetoothError
	)

	if hr != 0 {
		return bluetooth.BluetoothErrorSuccess, ole.NewError(hr)
	}

	return out, nil
}
