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

package bulk_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 bulk management client
type API interface {
	/*
	   GetBillRun gets the status report of the billrun requested*/
	GetBillRun(ctx context.Context, params *GetBillRunParams) (*GetBillRunOK, error)
	/*
	   ListBillRuns shows the status report of the billruns present in the system*/
	ListBillRuns(ctx context.Context, params *ListBillRunsParams) (*ListBillRunsOK, error)
	/*
	   ListBillRunsByOrganization shows the status report of the billruns present in the system*/
	ListBillRunsByOrganization(ctx context.Context, params *ListBillRunsByOrganizationParams) (*ListBillRunsByOrganizationOK, error)
	/*
	   ReRunAllBillRuns tries to re run the failed invoices in all the billruns*/
	ReRunAllBillRuns(ctx context.Context, params *ReRunAllBillRunsParams) (*ReRunAllBillRunsAccepted, error)
	/*
	   ReRunBillRun tries to re run the failed invoices in the billrun*/
	ReRunBillRun(ctx context.Context, params *ReRunBillRunParams) (*ReRunBillRunAccepted, error)
}

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

/*
GetBillRun gets the status report of the billrun requested
*/
func (a *Client) GetBillRun(ctx context.Context, params *GetBillRunParams) (*GetBillRunOK, error) {

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

}

/*
ListBillRuns shows the status report of the billruns present in the system
*/
func (a *Client) ListBillRuns(ctx context.Context, params *ListBillRunsParams) (*ListBillRunsOK, error) {

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

}

/*
ListBillRunsByOrganization shows the status report of the billruns present in the system
*/
func (a *Client) ListBillRunsByOrganization(ctx context.Context, params *ListBillRunsByOrganizationParams) (*ListBillRunsByOrganizationOK, error) {

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

}

/*
ReRunAllBillRuns tries to re run the failed invoices in all the billruns
*/
func (a *Client) ReRunAllBillRuns(ctx context.Context, params *ReRunAllBillRunsParams) (*ReRunAllBillRunsAccepted, error) {

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

}

/*
ReRunBillRun tries to re run the failed invoices in the billrun
*/
func (a *Client) ReRunBillRun(ctx context.Context, params *ReRunBillRunParams) (*ReRunBillRunAccepted, error) {

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

}
