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

package customer_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 customer management client
type API interface {
	/*
	   AddCustomer inserts a new customer in the system*/
	AddCustomer(ctx context.Context, params *AddCustomerParams) (*AddCustomerCreated, *AddCustomerAccepted, error)
	/*
	   GetCustomer returns the information about the customer with the given id*/
	GetCustomer(ctx context.Context, params *GetCustomerParams) (*GetCustomerOK, error)
	/*
	   ListCustomers lists all the customers in the system*/
	ListCustomers(ctx context.Context, params *ListCustomersParams) (*ListCustomersOK, error)
	/*
	   UpdateCustomer updates the information of the customer with the given id*/
	UpdateCustomer(ctx context.Context, params *UpdateCustomerParams) (*UpdateCustomerOK, *UpdateCustomerAccepted, error)
}

// New creates a new customer 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 customer management API
*/
type Client struct {
	transport runtime.ClientTransport
	formats   strfmt.Registry
	authInfo  runtime.ClientAuthInfoWriter
}

/*
AddCustomer inserts a new customer in the system
*/
func (a *Client) AddCustomer(ctx context.Context, params *AddCustomerParams) (*AddCustomerCreated, *AddCustomerAccepted, error) {

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "addCustomer",
		Method:             "POST",
		PathPattern:        "/customer",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &AddCustomerReader{formats: a.formats},
		AuthInfo:           a.authInfo,
		Context:            ctx,
		Client:             params.HTTPClient,
	})
	if err != nil {
		return nil, nil, err
	}
	switch value := result.(type) {
	case *AddCustomerCreated:
		return value, nil, nil
	case *AddCustomerAccepted:
		return nil, value, nil
	}
	return nil, nil, nil

}

/*
GetCustomer returns the information about the customer with the given id
*/
func (a *Client) GetCustomer(ctx context.Context, params *GetCustomerParams) (*GetCustomerOK, error) {

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

}

/*
ListCustomers lists all the customers in the system
*/
func (a *Client) ListCustomers(ctx context.Context, params *ListCustomersParams) (*ListCustomersOK, error) {

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

}

/*
UpdateCustomer updates the information of the customer with the given id
*/
func (a *Client) UpdateCustomer(ctx context.Context, params *UpdateCustomerParams) (*UpdateCustomerOK, *UpdateCustomerAccepted, error) {

	result, err := a.transport.Submit(&runtime.ClientOperation{
		ID:                 "updateCustomer",
		Method:             "PUT",
		PathPattern:        "/customer/{id}",
		ProducesMediaTypes: []string{"application/json"},
		ConsumesMediaTypes: []string{"application/json"},
		Schemes:            []string{"http", "https"},
		Params:             params,
		Reader:             &UpdateCustomerReader{formats: a.formats},
		AuthInfo:           a.authInfo,
		Context:            ctx,
		Client:             params.HTTPClient,
	})
	if err != nil {
		return nil, nil, err
	}
	switch value := result.(type) {
	case *UpdateCustomerOK:
		return value, nil, nil
	case *UpdateCustomerAccepted:
		return nil, value, nil
	}
	return nil, nil, nil

}
