// Package smartcardemulation provides the Chrome DevTools Protocol
// commands, types, and events for the SmartCardEmulation domain.
//
// Generated by the cdproto-gen command.
package smartcardemulation

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

import (
	"context"

	"github.com/chromedp/cdproto/cdp"
)

// EnableParams enables the |SmartCardEmulation| domain.
type EnableParams struct{}

// Enable enables the |SmartCardEmulation| domain.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/SmartCardEmulation#method-enable
func Enable() *EnableParams {
	return &EnableParams{}
}

// Do executes SmartCardEmulation.enable against the provided context.
func (p *EnableParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandEnable, nil, nil)
}

// DisableParams disables the |SmartCardEmulation| domain.
type DisableParams struct{}

// Disable disables the |SmartCardEmulation| domain.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/SmartCardEmulation#method-disable
func Disable() *DisableParams {
	return &DisableParams{}
}

// Do executes SmartCardEmulation.disable against the provided context.
func (p *DisableParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandDisable, nil, nil)
}

// ReportEstablishContextResultParams reports the successful result of a
// |SCardEstablishContext| call. This maps to: PC/SC Lite:
// https://pcsclite.apdu.fr/api/group__API.html#gaa1b8970169fd4883a6dc4a8f43f19b67
// Microsoft:
// https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardestablishcontext.
type ReportEstablishContextResultParams struct {
	RequestID string `json:"requestId"`
	ContextID int64  `json:"contextId"`
}

// ReportEstablishContextResult reports the successful result of a
// |SCardEstablishContext| call. This maps to: PC/SC Lite:
// https://pcsclite.apdu.fr/api/group__API.html#gaa1b8970169fd4883a6dc4a8f43f19b67
// Microsoft:
// https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardestablishcontext.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/SmartCardEmulation#method-reportEstablishContextResult
//
// parameters:
//
//	requestID
//	contextID
func ReportEstablishContextResult(requestID string, contextID int64) *ReportEstablishContextResultParams {
	return &ReportEstablishContextResultParams{
		RequestID: requestID,
		ContextID: contextID,
	}
}

// Do executes SmartCardEmulation.reportEstablishContextResult against the provided context.
func (p *ReportEstablishContextResultParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandReportEstablishContextResult, p, nil)
}

// ReportReleaseContextResultParams reports the successful result of a
// |SCardReleaseContext| call. This maps to: PC/SC Lite:
// https://pcsclite.apdu.fr/api/group__API.html#ga6aabcba7744c5c9419fdd6404f73a934
// Microsoft:
// https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardreleasecontext.
type ReportReleaseContextResultParams struct {
	RequestID string `json:"requestId"`
}

// ReportReleaseContextResult reports the successful result of a
// |SCardReleaseContext| call. This maps to: PC/SC Lite:
// https://pcsclite.apdu.fr/api/group__API.html#ga6aabcba7744c5c9419fdd6404f73a934
// Microsoft:
// https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardreleasecontext.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/SmartCardEmulation#method-reportReleaseContextResult
//
// parameters:
//
//	requestID
func ReportReleaseContextResult(requestID string) *ReportReleaseContextResultParams {
	return &ReportReleaseContextResultParams{
		RequestID: requestID,
	}
}

// Do executes SmartCardEmulation.reportReleaseContextResult against the provided context.
func (p *ReportReleaseContextResultParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandReportReleaseContextResult, p, nil)
}

// ReportListReadersResultParams reports the successful result of a
// |SCardListReaders| call. This maps to: PC/SC Lite:
// https://pcsclite.apdu.fr/api/group__API.html#ga93b07815789b3cf2629d439ecf20f0d9
// Microsoft:
// https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardlistreadersa.
type ReportListReadersResultParams struct {
	RequestID string   `json:"requestId"`
	Readers   []string `json:"readers"`
}

// ReportListReadersResult reports the successful result of a
// |SCardListReaders| call. This maps to: PC/SC Lite:
// https://pcsclite.apdu.fr/api/group__API.html#ga93b07815789b3cf2629d439ecf20f0d9
// Microsoft:
// https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardlistreadersa.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/SmartCardEmulation#method-reportListReadersResult
//
// parameters:
//
//	requestID
//	readers
func ReportListReadersResult(requestID string, readers []string) *ReportListReadersResultParams {
	return &ReportListReadersResultParams{
		RequestID: requestID,
		Readers:   readers,
	}
}

// Do executes SmartCardEmulation.reportListReadersResult against the provided context.
func (p *ReportListReadersResultParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandReportListReadersResult, p, nil)
}

// ReportGetStatusChangeResultParams reports the successful result of a
// |SCardGetStatusChange| call. This maps to: PC/SC Lite:
// https://pcsclite.apdu.fr/api/group__API.html#ga33247d5d1257d59e55647c3bb717db24
// Microsoft:
// https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardgetstatuschangea.
type ReportGetStatusChangeResultParams struct {
	RequestID    string            `json:"requestId"`
	ReaderStates []*ReaderStateOut `json:"readerStates"`
}

// ReportGetStatusChangeResult reports the successful result of a
// |SCardGetStatusChange| call. This maps to: PC/SC Lite:
// https://pcsclite.apdu.fr/api/group__API.html#ga33247d5d1257d59e55647c3bb717db24
// Microsoft:
// https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardgetstatuschangea.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/SmartCardEmulation#method-reportGetStatusChangeResult
//
// parameters:
//
//	requestID
//	readerStates
func ReportGetStatusChangeResult(requestID string, readerStates []*ReaderStateOut) *ReportGetStatusChangeResultParams {
	return &ReportGetStatusChangeResultParams{
		RequestID:    requestID,
		ReaderStates: readerStates,
	}
}

// Do executes SmartCardEmulation.reportGetStatusChangeResult against the provided context.
func (p *ReportGetStatusChangeResultParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandReportGetStatusChangeResult, p, nil)
}

// ReportBeginTransactionResultParams reports the result of a
// |SCardBeginTransaction| call. On success, this creates a new transaction
// object. This maps to: PC/SC Lite:
// https://pcsclite.apdu.fr/api/group__API.html#gaddb835dce01a0da1d6ca02d33ee7d861
// Microsoft:
// https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardbegintransaction.
type ReportBeginTransactionResultParams struct {
	RequestID string `json:"requestId"`
	Handle    int64  `json:"handle"`
}

// ReportBeginTransactionResult reports the result of a
// |SCardBeginTransaction| call. On success, this creates a new transaction
// object. This maps to: PC/SC Lite:
// https://pcsclite.apdu.fr/api/group__API.html#gaddb835dce01a0da1d6ca02d33ee7d861
// Microsoft:
// https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardbegintransaction.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/SmartCardEmulation#method-reportBeginTransactionResult
//
// parameters:
//
//	requestID
//	handle
func ReportBeginTransactionResult(requestID string, handle int64) *ReportBeginTransactionResultParams {
	return &ReportBeginTransactionResultParams{
		RequestID: requestID,
		Handle:    handle,
	}
}

// Do executes SmartCardEmulation.reportBeginTransactionResult against the provided context.
func (p *ReportBeginTransactionResultParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandReportBeginTransactionResult, p, nil)
}

// ReportPlainResultParams reports the successful result of a call that
// returns only a result code. Used for: |SCardCancel|, |SCardDisconnect|,
// |SCardSetAttrib|, |SCardEndTransaction|. This maps to: 1. SCardCancel PC/SC
// Lite:
// https://pcsclite.apdu.fr/api/group__API.html#gaacbbc0c6d6c0cbbeb4f4debf6fbeeee6
// Microsoft:
// https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardcancel
// 2. SCardDisconnect PC/SC Lite:
// https://pcsclite.apdu.fr/api/group__API.html#ga4be198045c73ec0deb79e66c0ca1738a
// Microsoft:
// https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scarddisconnect
// 3. SCardSetAttrib PC/SC Lite:
// https://pcsclite.apdu.fr/api/group__API.html#ga060f0038a4ddfd5dd2b8fadf3c3a2e4f
// Microsoft:
// https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardsetattrib
// 4. SCardEndTransaction PC/SC Lite:
// https://pcsclite.apdu.fr/api/group__API.html#gae8742473b404363e5c587f570d7e2f3b
// Microsoft:
// https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardendtransaction.
type ReportPlainResultParams struct {
	RequestID string `json:"requestId"`
}

// ReportPlainResult reports the successful result of a call that returns
// only a result code. Used for: |SCardCancel|, |SCardDisconnect|,
// |SCardSetAttrib|, |SCardEndTransaction|. This maps to: 1. SCardCancel PC/SC
// Lite:
// https://pcsclite.apdu.fr/api/group__API.html#gaacbbc0c6d6c0cbbeb4f4debf6fbeeee6
// Microsoft:
// https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardcancel
// 2. SCardDisconnect PC/SC Lite:
// https://pcsclite.apdu.fr/api/group__API.html#ga4be198045c73ec0deb79e66c0ca1738a
// Microsoft:
// https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scarddisconnect
// 3. SCardSetAttrib PC/SC Lite:
// https://pcsclite.apdu.fr/api/group__API.html#ga060f0038a4ddfd5dd2b8fadf3c3a2e4f
// Microsoft:
// https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardsetattrib
// 4. SCardEndTransaction PC/SC Lite:
// https://pcsclite.apdu.fr/api/group__API.html#gae8742473b404363e5c587f570d7e2f3b
// Microsoft:
// https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardendtransaction.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/SmartCardEmulation#method-reportPlainResult
//
// parameters:
//
//	requestID
func ReportPlainResult(requestID string) *ReportPlainResultParams {
	return &ReportPlainResultParams{
		RequestID: requestID,
	}
}

// Do executes SmartCardEmulation.reportPlainResult against the provided context.
func (p *ReportPlainResultParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandReportPlainResult, p, nil)
}

// ReportConnectResultParams reports the successful result of a
// |SCardConnect| call. This maps to: PC/SC Lite:
// https://pcsclite.apdu.fr/api/group__API.html#ga4e515829752e0a8dbc4d630696a8d6a5
// Microsoft:
// https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardconnecta.
type ReportConnectResultParams struct {
	RequestID      string   `json:"requestId"`
	Handle         int64    `json:"handle"`
	ActiveProtocol Protocol `json:"activeProtocol,omitempty,omitzero"`
}

// ReportConnectResult reports the successful result of a |SCardConnect|
// call. This maps to: PC/SC Lite:
// https://pcsclite.apdu.fr/api/group__API.html#ga4e515829752e0a8dbc4d630696a8d6a5
// Microsoft:
// https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardconnecta.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/SmartCardEmulation#method-reportConnectResult
//
// parameters:
//
//	requestID
//	handle
func ReportConnectResult(requestID string, handle int64) *ReportConnectResultParams {
	return &ReportConnectResultParams{
		RequestID: requestID,
		Handle:    handle,
	}
}

// WithActiveProtocol [no description].
func (p ReportConnectResultParams) WithActiveProtocol(activeProtocol Protocol) *ReportConnectResultParams {
	p.ActiveProtocol = activeProtocol
	return &p
}

// Do executes SmartCardEmulation.reportConnectResult against the provided context.
func (p *ReportConnectResultParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandReportConnectResult, p, nil)
}

// ReportDataResultParams reports the successful result of a call that sends
// back data on success. Used for |SCardTransmit|, |SCardControl|, and
// |SCardGetAttrib|. This maps to: 1. SCardTransmit PC/SC Lite:
// https://pcsclite.apdu.fr/api/group__API.html#ga9a2d77242a271310269065e64633ab99
// Microsoft:
// https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardtransmit
// 2. SCardControl PC/SC Lite:
// https://pcsclite.apdu.fr/api/group__API.html#gac3454d4657110fd7f753b2d3d8f4e32f
// Microsoft:
// https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardcontrol
// 3. SCardGetAttrib PC/SC Lite:
// https://pcsclite.apdu.fr/api/group__API.html#gaacfec51917255b7a25b94c5104961602
// Microsoft:
// https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardgetattrib.
type ReportDataResultParams struct {
	RequestID string `json:"requestId"`
	Data      string `json:"data"`
}

// ReportDataResult reports the successful result of a call that sends back
// data on success. Used for |SCardTransmit|, |SCardControl|, and
// |SCardGetAttrib|. This maps to: 1. SCardTransmit PC/SC Lite:
// https://pcsclite.apdu.fr/api/group__API.html#ga9a2d77242a271310269065e64633ab99
// Microsoft:
// https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardtransmit
// 2. SCardControl PC/SC Lite:
// https://pcsclite.apdu.fr/api/group__API.html#gac3454d4657110fd7f753b2d3d8f4e32f
// Microsoft:
// https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardcontrol
// 3. SCardGetAttrib PC/SC Lite:
// https://pcsclite.apdu.fr/api/group__API.html#gaacfec51917255b7a25b94c5104961602
// Microsoft:
// https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardgetattrib.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/SmartCardEmulation#method-reportDataResult
//
// parameters:
//
//	requestID
//	data
func ReportDataResult(requestID string, data string) *ReportDataResultParams {
	return &ReportDataResultParams{
		RequestID: requestID,
		Data:      data,
	}
}

// Do executes SmartCardEmulation.reportDataResult against the provided context.
func (p *ReportDataResultParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandReportDataResult, p, nil)
}

// ReportStatusResultParams reports the successful result of a |SCardStatus|
// call. This maps to: PC/SC Lite:
// https://pcsclite.apdu.fr/api/group__API.html#gae49c3c894ad7ac12a5b896bde70d0382
// Microsoft:
// https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardstatusa.
type ReportStatusResultParams struct {
	RequestID  string          `json:"requestId"`
	ReaderName string          `json:"readerName"`
	State      ConnectionState `json:"state"`
	Atr        string          `json:"atr"`
	Protocol   Protocol        `json:"protocol,omitempty,omitzero"`
}

// ReportStatusResult reports the successful result of a |SCardStatus| call.
// This maps to: PC/SC Lite:
// https://pcsclite.apdu.fr/api/group__API.html#gae49c3c894ad7ac12a5b896bde70d0382
// Microsoft:
// https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardstatusa.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/SmartCardEmulation#method-reportStatusResult
//
// parameters:
//
//	requestID
//	readerName
//	state
//	atr
func ReportStatusResult(requestID string, readerName string, state ConnectionState, atr string) *ReportStatusResultParams {
	return &ReportStatusResultParams{
		RequestID:  requestID,
		ReaderName: readerName,
		State:      state,
		Atr:        atr,
	}
}

// WithProtocol [no description].
func (p ReportStatusResultParams) WithProtocol(protocol Protocol) *ReportStatusResultParams {
	p.Protocol = protocol
	return &p
}

// Do executes SmartCardEmulation.reportStatusResult against the provided context.
func (p *ReportStatusResultParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandReportStatusResult, p, nil)
}

// ReportErrorParams reports an error result for the given request.
type ReportErrorParams struct {
	RequestID  string     `json:"requestId"`
	ResultCode ResultCode `json:"resultCode"`
}

// ReportError reports an error result for the given request.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/SmartCardEmulation#method-reportError
//
// parameters:
//
//	requestID
//	resultCode
func ReportError(requestID string, resultCode ResultCode) *ReportErrorParams {
	return &ReportErrorParams{
		RequestID:  requestID,
		ResultCode: resultCode,
	}
}

// Do executes SmartCardEmulation.reportError against the provided context.
func (p *ReportErrorParams) Do(ctx context.Context) (err error) {
	return cdp.Execute(ctx, CommandReportError, p, nil)
}

// Command names.
const (
	CommandEnable                       = "SmartCardEmulation.enable"
	CommandDisable                      = "SmartCardEmulation.disable"
	CommandReportEstablishContextResult = "SmartCardEmulation.reportEstablishContextResult"
	CommandReportReleaseContextResult   = "SmartCardEmulation.reportReleaseContextResult"
	CommandReportListReadersResult      = "SmartCardEmulation.reportListReadersResult"
	CommandReportGetStatusChangeResult  = "SmartCardEmulation.reportGetStatusChangeResult"
	CommandReportBeginTransactionResult = "SmartCardEmulation.reportBeginTransactionResult"
	CommandReportPlainResult            = "SmartCardEmulation.reportPlainResult"
	CommandReportConnectResult          = "SmartCardEmulation.reportConnectResult"
	CommandReportDataResult             = "SmartCardEmulation.reportDataResult"
	CommandReportStatusResult           = "SmartCardEmulation.reportStatusResult"
	CommandReportError                  = "SmartCardEmulation.reportError"
)
