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

//go:build windows

//nolint:all
package exchangeactivesyncprovisioning

import (
	"syscall"
	"unsafe"

	"github.com/go-ole/go-ole"
)

const SignatureEasClientDeviceInformation string = "rc(Windows.Security.ExchangeActiveSyncProvisioning.EasClientDeviceInformation;{54dfd981-1968-4ca3-b958-e595d16505eb})"

type EasClientDeviceInformation struct {
	ole.IUnknown
}

func NewEasClientDeviceInformation() (*EasClientDeviceInformation, error) {
	inspectable, err := ole.RoActivateInstance("Windows.Security.ExchangeActiveSyncProvisioning.EasClientDeviceInformation")
	if err != nil {
		return nil, err
	}
	return (*EasClientDeviceInformation)(unsafe.Pointer(inspectable)), nil
}

func (impl *EasClientDeviceInformation) GetId() (syscall.GUID, error) {
	itf := impl.MustQueryInterface(ole.NewGUID(GUIDiEasClientDeviceInformation))
	defer itf.Release()
	v := (*iEasClientDeviceInformation)(unsafe.Pointer(itf))
	return v.GetId()
}

func (impl *EasClientDeviceInformation) GetOperatingSystem() (string, error) {
	itf := impl.MustQueryInterface(ole.NewGUID(GUIDiEasClientDeviceInformation))
	defer itf.Release()
	v := (*iEasClientDeviceInformation)(unsafe.Pointer(itf))
	return v.GetOperatingSystem()
}

func (impl *EasClientDeviceInformation) GetFriendlyName() (string, error) {
	itf := impl.MustQueryInterface(ole.NewGUID(GUIDiEasClientDeviceInformation))
	defer itf.Release()
	v := (*iEasClientDeviceInformation)(unsafe.Pointer(itf))
	return v.GetFriendlyName()
}

func (impl *EasClientDeviceInformation) GetSystemManufacturer() (string, error) {
	itf := impl.MustQueryInterface(ole.NewGUID(GUIDiEasClientDeviceInformation))
	defer itf.Release()
	v := (*iEasClientDeviceInformation)(unsafe.Pointer(itf))
	return v.GetSystemManufacturer()
}

func (impl *EasClientDeviceInformation) GetSystemProductName() (string, error) {
	itf := impl.MustQueryInterface(ole.NewGUID(GUIDiEasClientDeviceInformation))
	defer itf.Release()
	v := (*iEasClientDeviceInformation)(unsafe.Pointer(itf))
	return v.GetSystemProductName()
}

func (impl *EasClientDeviceInformation) GetSystemSku() (string, error) {
	itf := impl.MustQueryInterface(ole.NewGUID(GUIDiEasClientDeviceInformation))
	defer itf.Release()
	v := (*iEasClientDeviceInformation)(unsafe.Pointer(itf))
	return v.GetSystemSku()
}

func (impl *EasClientDeviceInformation) GetSystemHardwareVersion() (string, error) {
	itf := impl.MustQueryInterface(ole.NewGUID(GUIDiEasClientDeviceInformation2))
	defer itf.Release()
	v := (*iEasClientDeviceInformation2)(unsafe.Pointer(itf))
	return v.GetSystemHardwareVersion()
}

func (impl *EasClientDeviceInformation) GetSystemFirmwareVersion() (string, error) {
	itf := impl.MustQueryInterface(ole.NewGUID(GUIDiEasClientDeviceInformation2))
	defer itf.Release()
	v := (*iEasClientDeviceInformation2)(unsafe.Pointer(itf))
	return v.GetSystemFirmwareVersion()
}

const GUIDiEasClientDeviceInformation string = "54dfd981-1968-4ca3-b958-e595d16505eb"
const SignatureiEasClientDeviceInformation string = "{54dfd981-1968-4ca3-b958-e595d16505eb}"

type iEasClientDeviceInformation struct {
	ole.IInspectable
}

type iEasClientDeviceInformationVtbl struct {
	ole.IInspectableVtbl

	GetId                 uintptr
	GetOperatingSystem    uintptr
	GetFriendlyName       uintptr
	GetSystemManufacturer uintptr
	GetSystemProductName  uintptr
	GetSystemSku          uintptr
}

func (v *iEasClientDeviceInformation) VTable() *iEasClientDeviceInformationVtbl {
	return (*iEasClientDeviceInformationVtbl)(unsafe.Pointer(v.RawVTable))
}

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

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

	return out, nil
}

func (v *iEasClientDeviceInformation) GetOperatingSystem() (string, error) {
	var outHStr ole.HString
	hr, _, _ := syscall.SyscallN(
		v.VTable().GetOperatingSystem,
		uintptr(unsafe.Pointer(v)),        // this
		uintptr(unsafe.Pointer(&outHStr)), // out string
	)

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

	out := outHStr.String()
	ole.DeleteHString(outHStr)
	return out, nil
}

func (v *iEasClientDeviceInformation) GetFriendlyName() (string, error) {
	var outHStr ole.HString
	hr, _, _ := syscall.SyscallN(
		v.VTable().GetFriendlyName,
		uintptr(unsafe.Pointer(v)),        // this
		uintptr(unsafe.Pointer(&outHStr)), // out string
	)

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

	out := outHStr.String()
	ole.DeleteHString(outHStr)
	return out, nil
}

func (v *iEasClientDeviceInformation) GetSystemManufacturer() (string, error) {
	var outHStr ole.HString
	hr, _, _ := syscall.SyscallN(
		v.VTable().GetSystemManufacturer,
		uintptr(unsafe.Pointer(v)),        // this
		uintptr(unsafe.Pointer(&outHStr)), // out string
	)

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

	out := outHStr.String()
	ole.DeleteHString(outHStr)
	return out, nil
}

func (v *iEasClientDeviceInformation) GetSystemProductName() (string, error) {
	var outHStr ole.HString
	hr, _, _ := syscall.SyscallN(
		v.VTable().GetSystemProductName,
		uintptr(unsafe.Pointer(v)),        // this
		uintptr(unsafe.Pointer(&outHStr)), // out string
	)

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

	out := outHStr.String()
	ole.DeleteHString(outHStr)
	return out, nil
}

func (v *iEasClientDeviceInformation) GetSystemSku() (string, error) {
	var outHStr ole.HString
	hr, _, _ := syscall.SyscallN(
		v.VTable().GetSystemSku,
		uintptr(unsafe.Pointer(v)),        // this
		uintptr(unsafe.Pointer(&outHStr)), // out string
	)

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

	out := outHStr.String()
	ole.DeleteHString(outHStr)
	return out, nil
}

const GUIDiEasClientDeviceInformation2 string = "ffb35923-bb26-4d6a-81bc-165aee0ad754"
const SignatureiEasClientDeviceInformation2 string = "{ffb35923-bb26-4d6a-81bc-165aee0ad754}"

type iEasClientDeviceInformation2 struct {
	ole.IInspectable
}

type iEasClientDeviceInformation2Vtbl struct {
	ole.IInspectableVtbl

	GetSystemHardwareVersion uintptr
	GetSystemFirmwareVersion uintptr
}

func (v *iEasClientDeviceInformation2) VTable() *iEasClientDeviceInformation2Vtbl {
	return (*iEasClientDeviceInformation2Vtbl)(unsafe.Pointer(v.RawVTable))
}

func (v *iEasClientDeviceInformation2) GetSystemHardwareVersion() (string, error) {
	var outHStr ole.HString
	hr, _, _ := syscall.SyscallN(
		v.VTable().GetSystemHardwareVersion,
		uintptr(unsafe.Pointer(v)),        // this
		uintptr(unsafe.Pointer(&outHStr)), // out string
	)

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

	out := outHStr.String()
	ole.DeleteHString(outHStr)
	return out, nil
}

func (v *iEasClientDeviceInformation2) GetSystemFirmwareVersion() (string, error) {
	var outHStr ole.HString
	hr, _, _ := syscall.SyscallN(
		v.VTable().GetSystemFirmwareVersion,
		uintptr(unsafe.Pointer(v)),        // this
		uintptr(unsafe.Pointer(&outHStr)), // out string
	)

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

	out := outHStr.String()
	ole.DeleteHString(outHStr)
	return out, nil
}
