// Code generated by go-swagger; DO NOT EDIT.

package vc_service

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

import (
	"github.com/go-openapi/runtime"
	"github.com/go-openapi/strfmt"
)

// New creates a new vc service API client.
func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService {
	return &Client{transport: transport, formats: formats}
}

/*
Client for vc service API
*/
type Client struct {
	transport runtime.ClientTransport
	formats   strfmt.Registry
}

// ClientOption may be used to customize the behavior of Client methods.
type ClientOption func(*runtime.ClientOperation)

// ClientService is the interface for Client methods
type ClientService interface {
	GetVcWellKnown(params *GetVcWellKnownParams, opts ...ClientOption) (*GetVcWellKnownOK, error)

	PublishVerifiableCredential(params *PublishVerifiableCredentialParams, opts ...ClientOption) (*PublishVerifiableCredentialOK, error)

	RevokeVerifiableCredential(params *RevokeVerifiableCredentialParams, opts ...ClientOption) (*RevokeVerifiableCredentialOK, error)

	SearchVerifiableCredentials(params *SearchVerifiableCredentialsParams, opts ...ClientOption) (*SearchVerifiableCredentialsOK, error)

	VerifyVerifiableCredential(params *VerifyVerifiableCredentialParams, opts ...ClientOption) (*VerifyVerifiableCredentialOK, error)

	SetTransport(transport runtime.ClientTransport)
}

/*
GetVcWellKnown returns the well known verifiable credentials for the specified Id
*/
func (a *Client) GetVcWellKnown(params *GetVcWellKnownParams, opts ...ClientOption) (*GetVcWellKnownOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewGetVcWellKnownParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "GetVcWellKnown",
		Method:             "GET",
		PathPattern:        "/v1alpha1/vc/{id}/.well-known/vcs.json",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http"},
		Params:             params,
		Reader:             &GetVcWellKnownReader{formats: a.formats},
		Context:            params.Context,
		Client:             params.HTTPClient,
	}
	for _, opt := range opts {
		opt(op)
	}

	result, err := a.transport.Submit(op)
	if err != nil {
		return nil, err
	}
	success, ok := result.(*GetVcWellKnownOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*GetVcWellKnownDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
PublishVerifiableCredential publishes a verifiable credential
*/
func (a *Client) PublishVerifiableCredential(params *PublishVerifiableCredentialParams, opts ...ClientOption) (*PublishVerifiableCredentialOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewPublishVerifiableCredentialParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "PublishVerifiableCredential",
		Method:             "POST",
		PathPattern:        "/v1alpha1/vc/publish",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http"},
		Params:             params,
		Reader:             &PublishVerifiableCredentialReader{formats: a.formats},
		Context:            params.Context,
		Client:             params.HTTPClient,
	}
	for _, opt := range opts {
		opt(op)
	}

	result, err := a.transport.Submit(op)
	if err != nil {
		return nil, err
	}
	success, ok := result.(*PublishVerifiableCredentialOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*PublishVerifiableCredentialDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
RevokeVerifiableCredential revokes a verifiable credential t h i s a c t i o n i s n o t r e v e r s i b l e
*/
func (a *Client) RevokeVerifiableCredential(params *RevokeVerifiableCredentialParams, opts ...ClientOption) (*RevokeVerifiableCredentialOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewRevokeVerifiableCredentialParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "RevokeVerifiableCredential",
		Method:             "POST",
		PathPattern:        "/v1alpha1/vc/revoke",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http"},
		Params:             params,
		Reader:             &RevokeVerifiableCredentialReader{formats: a.formats},
		Context:            params.Context,
		Client:             params.HTTPClient,
	}
	for _, opt := range opts {
		opt(op)
	}

	result, err := a.transport.Submit(op)
	if err != nil {
		return nil, err
	}
	success, ok := result.(*RevokeVerifiableCredentialOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*RevokeVerifiableCredentialDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
SearchVerifiableCredentials searches for verifiable credentials based on the specified criteria
*/
func (a *Client) SearchVerifiableCredentials(params *SearchVerifiableCredentialsParams, opts ...ClientOption) (*SearchVerifiableCredentialsOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewSearchVerifiableCredentialsParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "SearchVerifiableCredentials",
		Method:             "POST",
		PathPattern:        "/v1alpha1/vc/search",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http"},
		Params:             params,
		Reader:             &SearchVerifiableCredentialsReader{formats: a.formats},
		Context:            params.Context,
		Client:             params.HTTPClient,
	}
	for _, opt := range opts {
		opt(op)
	}

	result, err := a.transport.Submit(op)
	if err != nil {
		return nil, err
	}
	success, ok := result.(*SearchVerifiableCredentialsOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*SearchVerifiableCredentialsDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

/*
VerifyVerifiableCredential verifies a verifiable credential
*/
func (a *Client) VerifyVerifiableCredential(params *VerifyVerifiableCredentialParams, opts ...ClientOption) (*VerifyVerifiableCredentialOK, error) {
	// TODO: Validate the params before sending
	if params == nil {
		params = NewVerifyVerifiableCredentialParams()
	}
	op := &runtime.ClientOperation{
		ID:                 "VerifyVerifiableCredential",
		Method:             "POST",
		PathPattern:        "/v1alpha1/vc/verify",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http"},
		Params:             params,
		Reader:             &VerifyVerifiableCredentialReader{formats: a.formats},
		Context:            params.Context,
		Client:             params.HTTPClient,
	}
	for _, opt := range opts {
		opt(op)
	}

	result, err := a.transport.Submit(op)
	if err != nil {
		return nil, err
	}
	success, ok := result.(*VerifyVerifiableCredentialOK)
	if ok {
		return success, nil
	}
	// unexpected success response
	unexpectedSuccess := result.(*VerifyVerifiableCredentialDefault)
	return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code())
}

// SetTransport changes the transport on the client
func (a *Client) SetTransport(transport runtime.ClientTransport) {
	a.transport = transport
}
