// Package digitalcredentials provides the Chrome DevTools Protocol
// commands, types, and events for the DigitalCredentials domain.
//
// This domain allows interacting with the Digital Credentials API for
// automation.
//
// Generated by the cdproto-gen command.
package digitalcredentials

// Code generated by cdproto-gen. DO NOT EDIT.

import (
	"context"

	"github.com/chromedp/cdproto/cdp"
	"github.com/go-json-experiment/json/jsontext"
)

// SetVirtualWalletBehaviorParams sets the behavior of the virtual wallet for
// digital credential requests issued from this frame.
type SetVirtualWalletBehaviorParams struct {
	Action   VirtualWalletAction `json:"action"`                      // The action of the virtual wallet.
	Protocol string              `json:"protocol,omitempty,omitzero"` // The protocol identifier (e.g. "openid4vp"). Required when |action| is "respond", forbidden otherwise.
	Response jsontext.Value      `json:"response,omitempty,omitzero"`
	FrameID  cdp.FrameID         `json:"frameId,omitempty,omitzero"` // The frame to scope the virtual wallet behavior to.
}

// SetVirtualWalletBehavior sets the behavior of the virtual wallet for
// digital credential requests issued from this frame.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DigitalCredentials#method-setVirtualWalletBehavior
//
// parameters:
//
//	action - The action of the virtual wallet.
func SetVirtualWalletBehavior(action VirtualWalletAction) *SetVirtualWalletBehaviorParams {
	return &SetVirtualWalletBehaviorParams{
		Action: action,
	}
}

// WithProtocol the protocol identifier (e.g. "openid4vp"). Required when
// |action| is "respond", forbidden otherwise.
func (p SetVirtualWalletBehaviorParams) WithProtocol(protocol string) *SetVirtualWalletBehaviorParams {
	p.Protocol = protocol
	return &p
}

// WithResponse the response data object returned by the wallet. Required
// when |action| is "respond", forbidden otherwise.
func (p SetVirtualWalletBehaviorParams) WithResponse(response jsontext.Value) *SetVirtualWalletBehaviorParams {
	p.Response = response
	return &p
}

// WithFrameID the frame to scope the virtual wallet behavior to.
func (p SetVirtualWalletBehaviorParams) WithFrameID(frameID cdp.FrameID) *SetVirtualWalletBehaviorParams {
	p.FrameID = frameID
	return &p
}

// Do executes DigitalCredentials.setVirtualWalletBehavior against the provided context.
func (p *SetVirtualWalletBehaviorParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandSetVirtualWalletBehavior, p, nil)
}

// Command names.
const (
	CommandSetVirtualWalletBehavior = "DigitalCredentials.setVirtualWalletBehavior"
)
