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

package product_management

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

import (
	"context"

	"github.com/go-openapi/runtime"

	strfmt "github.com/go-openapi/strfmt"
)

//go:generate mockery -name API -inpkg

// API is the interface of the product management client
type API interface {
	/*
	   AddProduct inserts a new product in the system*/
	AddProduct(ctx context.Context, params *AddProductParams) (*AddProductCreated, error)
	/*
	   GetProduct returns the information about the product with the given id*/
	GetProduct(ctx context.Context, params *GetProductParams) (*GetProductOK, error)
	/*
	   ListProducts lists all the products in the system*/
	ListProducts(ctx context.Context, params *ListProductsParams) (*ListProductsOK, error)
	/*
	   UpdateProduct updates the information of the product with the given id*/
	UpdateProduct(ctx context.Context, params *UpdateProductParams) (*UpdateProductOK, error)
}

// New creates a new product management API client.
func New(transport runtime.ClientTransport, formats strfmt.Registry, authInfo runtime.ClientAuthInfoWriter) *Client {
	return &Client{
		transport: transport,
		formats:   formats,
		authInfo:  authInfo,
	}
}

/*
Client for product management API
*/
type Client struct {
	transport runtime.ClientTransport
	formats   strfmt.Registry
	authInfo  runtime.ClientAuthInfoWriter
}

/*
AddProduct inserts a new product in the system
*/
func (a *Client) AddProduct(ctx context.Context, params *AddProductParams) (*AddProductCreated, error) {

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "addProduct",
		Method:             "POST",
		PathPattern:        "/product",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &AddProductReader{formats: a.formats},
		AuthInfo:           a.authInfo,
		Context:            ctx,
		Client:             params.HTTPClient,
	})
	if err != nil {
		return nil, err
	}
	return result.(*AddProductCreated), nil

}

/*
GetProduct returns the information about the product with the given id
*/
func (a *Client) GetProduct(ctx context.Context, params *GetProductParams) (*GetProductOK, error) {

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "getProduct",
		Method:             "GET",
		PathPattern:        "/product/{id}",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &GetProductReader{formats: a.formats},
		AuthInfo:           a.authInfo,
		Context:            ctx,
		Client:             params.HTTPClient,
	})
	if err != nil {
		return nil, err
	}
	return result.(*GetProductOK), nil

}

/*
ListProducts lists all the products in the system
*/
func (a *Client) ListProducts(ctx context.Context, params *ListProductsParams) (*ListProductsOK, error) {

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "listProducts",
		Method:             "GET",
		PathPattern:        "/product",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &ListProductsReader{formats: a.formats},
		AuthInfo:           a.authInfo,
		Context:            ctx,
		Client:             params.HTTPClient,
	})
	if err != nil {
		return nil, err
	}
	return result.(*ListProductsOK), nil

}

/*
UpdateProduct updates the information of the product with the given id
*/
func (a *Client) UpdateProduct(ctx context.Context, params *UpdateProductParams) (*UpdateProductOK, error) {

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "updateProduct",
		Method:             "PUT",
		PathPattern:        "/product/{id}",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &UpdateProductReader{formats: a.formats},
		AuthInfo:           a.authInfo,
		Context:            ctx,
		Client:             params.HTTPClient,
	})
	if err != nil {
		return nil, err
	}
	return result.(*UpdateProductOK), nil

}
