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

// (c) 2012-2020 by Taxnexus, Inc.
// All rights reserved worldwide.
// Proprietary product; unlicensed use is not allowed

package accounts

import (
	"encoding/json"
	stderrors "errors"
	"fmt"
	"io"

	"code.tnxs.net/vernonkeenan/lib/api/sfgate/sfgate_models"
	"github.com/go-openapi/runtime"
	"github.com/go-openapi/strfmt"
)

// PutAccountsReader is a Reader for the PutAccounts structure.
type PutAccountsReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PutAccountsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewPutAccountsOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewPutAccountsUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewPutAccountsForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewPutAccountsNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewPutAccountsUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPutAccountsInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[PUT /accounts] putAccounts", response, response.Code())
	}
}

// NewPutAccountsOK creates a PutAccountsOK with default headers values
func NewPutAccountsOK() *PutAccountsOK {
	return &PutAccountsOK{}
}

// PutAccountsOK describes a response with status code 200, with default header values.
//
// Response with Account objects
type PutAccountsOK struct {
	Payload *sfgate_models.AccountResponse
}

// IsSuccess returns true when this put accounts o k response has a 2xx status code
func (o *PutAccountsOK) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this put accounts o k response has a 3xx status code
func (o *PutAccountsOK) IsRedirect() bool {
	return false
}

// IsClientError returns true when this put accounts o k response has a 4xx status code
func (o *PutAccountsOK) IsClientError() bool {
	return false
}

// IsServerError returns true when this put accounts o k response has a 5xx status code
func (o *PutAccountsOK) IsServerError() bool {
	return false
}

// IsCode returns true when this put accounts o k response a status code equal to that given
func (o *PutAccountsOK) IsCode(code int) bool {
	return code == 200
}

// Code gets the status code for the put accounts o k response
func (o *PutAccountsOK) Code() int {
	return 200
}

func (o *PutAccountsOK) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /accounts][%d] putAccountsOK %s", 200, payload)
}

func (o *PutAccountsOK) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /accounts][%d] putAccountsOK %s", 200, payload)
}

func (o *PutAccountsOK) GetPayload() *sfgate_models.AccountResponse {
	return o.Payload
}

func (o *PutAccountsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	o.Payload = new(sfgate_models.AccountResponse)

	// response payload
	if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
		return err
	}

	return nil
}

// NewPutAccountsUnauthorized creates a PutAccountsUnauthorized with default headers values
func NewPutAccountsUnauthorized() *PutAccountsUnauthorized {
	return &PutAccountsUnauthorized{}
}

// PutAccountsUnauthorized describes a response with status code 401, with default header values.
//
// Access unauthorized, invalid API-KEY was used
type PutAccountsUnauthorized struct {
	Payload *sfgate_models.Error
}

// IsSuccess returns true when this put accounts unauthorized response has a 2xx status code
func (o *PutAccountsUnauthorized) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this put accounts unauthorized response has a 3xx status code
func (o *PutAccountsUnauthorized) IsRedirect() bool {
	return false
}

// IsClientError returns true when this put accounts unauthorized response has a 4xx status code
func (o *PutAccountsUnauthorized) IsClientError() bool {
	return true
}

// IsServerError returns true when this put accounts unauthorized response has a 5xx status code
func (o *PutAccountsUnauthorized) IsServerError() bool {
	return false
}

// IsCode returns true when this put accounts unauthorized response a status code equal to that given
func (o *PutAccountsUnauthorized) IsCode(code int) bool {
	return code == 401
}

// Code gets the status code for the put accounts unauthorized response
func (o *PutAccountsUnauthorized) Code() int {
	return 401
}

func (o *PutAccountsUnauthorized) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /accounts][%d] putAccountsUnauthorized %s", 401, payload)
}

func (o *PutAccountsUnauthorized) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /accounts][%d] putAccountsUnauthorized %s", 401, payload)
}

func (o *PutAccountsUnauthorized) GetPayload() *sfgate_models.Error {
	return o.Payload
}

func (o *PutAccountsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	o.Payload = new(sfgate_models.Error)

	// response payload
	if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
		return err
	}

	return nil
}

// NewPutAccountsForbidden creates a PutAccountsForbidden with default headers values
func NewPutAccountsForbidden() *PutAccountsForbidden {
	return &PutAccountsForbidden{}
}

// PutAccountsForbidden describes a response with status code 403, with default header values.
//
// Access forbidden, account lacks access
type PutAccountsForbidden struct {
	Payload *sfgate_models.Error
}

// IsSuccess returns true when this put accounts forbidden response has a 2xx status code
func (o *PutAccountsForbidden) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this put accounts forbidden response has a 3xx status code
func (o *PutAccountsForbidden) IsRedirect() bool {
	return false
}

// IsClientError returns true when this put accounts forbidden response has a 4xx status code
func (o *PutAccountsForbidden) IsClientError() bool {
	return true
}

// IsServerError returns true when this put accounts forbidden response has a 5xx status code
func (o *PutAccountsForbidden) IsServerError() bool {
	return false
}

// IsCode returns true when this put accounts forbidden response a status code equal to that given
func (o *PutAccountsForbidden) IsCode(code int) bool {
	return code == 403
}

// Code gets the status code for the put accounts forbidden response
func (o *PutAccountsForbidden) Code() int {
	return 403
}

func (o *PutAccountsForbidden) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /accounts][%d] putAccountsForbidden %s", 403, payload)
}

func (o *PutAccountsForbidden) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /accounts][%d] putAccountsForbidden %s", 403, payload)
}

func (o *PutAccountsForbidden) GetPayload() *sfgate_models.Error {
	return o.Payload
}

func (o *PutAccountsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	o.Payload = new(sfgate_models.Error)

	// response payload
	if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
		return err
	}

	return nil
}

// NewPutAccountsNotFound creates a PutAccountsNotFound with default headers values
func NewPutAccountsNotFound() *PutAccountsNotFound {
	return &PutAccountsNotFound{}
}

// PutAccountsNotFound describes a response with status code 404, with default header values.
//
// Resource was not found
type PutAccountsNotFound struct {
	Payload *sfgate_models.Error
}

// IsSuccess returns true when this put accounts not found response has a 2xx status code
func (o *PutAccountsNotFound) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this put accounts not found response has a 3xx status code
func (o *PutAccountsNotFound) IsRedirect() bool {
	return false
}

// IsClientError returns true when this put accounts not found response has a 4xx status code
func (o *PutAccountsNotFound) IsClientError() bool {
	return true
}

// IsServerError returns true when this put accounts not found response has a 5xx status code
func (o *PutAccountsNotFound) IsServerError() bool {
	return false
}

// IsCode returns true when this put accounts not found response a status code equal to that given
func (o *PutAccountsNotFound) IsCode(code int) bool {
	return code == 404
}

// Code gets the status code for the put accounts not found response
func (o *PutAccountsNotFound) Code() int {
	return 404
}

func (o *PutAccountsNotFound) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /accounts][%d] putAccountsNotFound %s", 404, payload)
}

func (o *PutAccountsNotFound) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /accounts][%d] putAccountsNotFound %s", 404, payload)
}

func (o *PutAccountsNotFound) GetPayload() *sfgate_models.Error {
	return o.Payload
}

func (o *PutAccountsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	o.Payload = new(sfgate_models.Error)

	// response payload
	if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
		return err
	}

	return nil
}

// NewPutAccountsUnprocessableEntity creates a PutAccountsUnprocessableEntity with default headers values
func NewPutAccountsUnprocessableEntity() *PutAccountsUnprocessableEntity {
	return &PutAccountsUnprocessableEntity{}
}

// PutAccountsUnprocessableEntity describes a response with status code 422, with default header values.
//
// Unprocessable Entity, likely a bad parameter
type PutAccountsUnprocessableEntity struct {
	Payload *sfgate_models.Error
}

// IsSuccess returns true when this put accounts unprocessable entity response has a 2xx status code
func (o *PutAccountsUnprocessableEntity) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this put accounts unprocessable entity response has a 3xx status code
func (o *PutAccountsUnprocessableEntity) IsRedirect() bool {
	return false
}

// IsClientError returns true when this put accounts unprocessable entity response has a 4xx status code
func (o *PutAccountsUnprocessableEntity) IsClientError() bool {
	return true
}

// IsServerError returns true when this put accounts unprocessable entity response has a 5xx status code
func (o *PutAccountsUnprocessableEntity) IsServerError() bool {
	return false
}

// IsCode returns true when this put accounts unprocessable entity response a status code equal to that given
func (o *PutAccountsUnprocessableEntity) IsCode(code int) bool {
	return code == 422
}

// Code gets the status code for the put accounts unprocessable entity response
func (o *PutAccountsUnprocessableEntity) Code() int {
	return 422
}

func (o *PutAccountsUnprocessableEntity) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /accounts][%d] putAccountsUnprocessableEntity %s", 422, payload)
}

func (o *PutAccountsUnprocessableEntity) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /accounts][%d] putAccountsUnprocessableEntity %s", 422, payload)
}

func (o *PutAccountsUnprocessableEntity) GetPayload() *sfgate_models.Error {
	return o.Payload
}

func (o *PutAccountsUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	o.Payload = new(sfgate_models.Error)

	// response payload
	if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
		return err
	}

	return nil
}

// NewPutAccountsInternalServerError creates a PutAccountsInternalServerError with default headers values
func NewPutAccountsInternalServerError() *PutAccountsInternalServerError {
	return &PutAccountsInternalServerError{}
}

// PutAccountsInternalServerError describes a response with status code 500, with default header values.
//
// Server Internal Error
type PutAccountsInternalServerError struct {
	Payload *sfgate_models.Error
}

// IsSuccess returns true when this put accounts internal server error response has a 2xx status code
func (o *PutAccountsInternalServerError) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this put accounts internal server error response has a 3xx status code
func (o *PutAccountsInternalServerError) IsRedirect() bool {
	return false
}

// IsClientError returns true when this put accounts internal server error response has a 4xx status code
func (o *PutAccountsInternalServerError) IsClientError() bool {
	return false
}

// IsServerError returns true when this put accounts internal server error response has a 5xx status code
func (o *PutAccountsInternalServerError) IsServerError() bool {
	return true
}

// IsCode returns true when this put accounts internal server error response a status code equal to that given
func (o *PutAccountsInternalServerError) IsCode(code int) bool {
	return code == 500
}

// Code gets the status code for the put accounts internal server error response
func (o *PutAccountsInternalServerError) Code() int {
	return 500
}

func (o *PutAccountsInternalServerError) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /accounts][%d] putAccountsInternalServerError %s", 500, payload)
}

func (o *PutAccountsInternalServerError) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /accounts][%d] putAccountsInternalServerError %s", 500, payload)
}

func (o *PutAccountsInternalServerError) GetPayload() *sfgate_models.Error {
	return o.Payload
}

func (o *PutAccountsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error {

	o.Payload = new(sfgate_models.Error)

	// response payload
	if err := consumer.Consume(response.Body(), o.Payload); err != nil && !stderrors.Is(err, io.EOF) {
		return err
	}

	return nil
}
