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

//go:build windows

//nolint:all
package notifications

import (
	"syscall"
	"unsafe"

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

const SignatureToastNotifier string = "rc(Windows.UI.Notifications.ToastNotifier;{75927b93-03f3-41ec-91d3-6e5bac1b38e7})"

type ToastNotifier struct {
	ole.IUnknown
}

func (impl *ToastNotifier) Show(notification *ToastNotification) error {
	itf := impl.MustQueryInterface(ole.NewGUID(GUIDiToastNotifier))
	defer itf.Release()
	v := (*iToastNotifier)(unsafe.Pointer(itf))
	return v.Show(notification)
}

const (
	GUIDiToastNotifier      string = "75927b93-03f3-41ec-91d3-6e5bac1b38e7"
	SignatureiToastNotifier string = "{75927b93-03f3-41ec-91d3-6e5bac1b38e7}"
)

type iToastNotifier struct {
	ole.IInspectable
}

type iToastNotifierVtbl struct {
	ole.IInspectableVtbl

	Show                           uintptr
	Hide                           uintptr
	GetSetting                     uintptr
	AddToSchedule                  uintptr
	RemoveFromSchedule             uintptr
	GetScheduledToastNotifications uintptr
}

func (v *iToastNotifier) VTable() *iToastNotifierVtbl {
	return (*iToastNotifierVtbl)(unsafe.Pointer(v.RawVTable))
}

func (v *iToastNotifier) Show(notification *ToastNotification) error {
	hr, _, _ := syscall.SyscallN(
		v.VTable().Show,
		uintptr(unsafe.Pointer(v)),            // this
		uintptr(unsafe.Pointer(notification)), // in ToastNotification
	)

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

	return nil
}
