// 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 financial_statements

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

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

// PutFinancialStatementReader is a Reader for the PutFinancialStatement structure.
type PutFinancialStatementReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PutFinancialStatementReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewPutFinancialStatementOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewPutFinancialStatementUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewPutFinancialStatementForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewPutFinancialStatementNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 409:
		result := NewPutFinancialStatementConflict()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewPutFinancialStatementUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPutFinancialStatementInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[PUT /financialstatements] putFinancialStatement", response, response.Code())
	}
}

// NewPutFinancialStatementOK creates a PutFinancialStatementOK with default headers values
func NewPutFinancialStatementOK() *PutFinancialStatementOK {
	return &PutFinancialStatementOK{}
}

// PutFinancialStatementOK describes a response with status code 200, with default header values.
//
// Response with FinancialStatement objects
type PutFinancialStatementOK struct {
	Payload *research_models.FinancialStatementResponse
}

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

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

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

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

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

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

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

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

func (o *PutFinancialStatementOK) GetPayload() *research_models.FinancialStatementResponse {
	return o.Payload
}

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

	o.Payload = new(research_models.FinancialStatementResponse)

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

	return nil
}

// NewPutFinancialStatementUnauthorized creates a PutFinancialStatementUnauthorized with default headers values
func NewPutFinancialStatementUnauthorized() *PutFinancialStatementUnauthorized {
	return &PutFinancialStatementUnauthorized{}
}

// PutFinancialStatementUnauthorized describes a response with status code 401, with default header values.
//
// Access unauthorized, invalid API-KEY was used
type PutFinancialStatementUnauthorized struct {
	AccessControlAllowOrigin string

	Payload *research_models.Error
}

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

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

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

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

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

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

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

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

func (o *PutFinancialStatementUnauthorized) GetPayload() *research_models.Error {
	return o.Payload
}

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

	// hydrates response header Access-Control-Allow-Origin
	hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")

	if hdrAccessControlAllowOrigin != "" {
		o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
	}

	o.Payload = new(research_models.Error)

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

	return nil
}

// NewPutFinancialStatementForbidden creates a PutFinancialStatementForbidden with default headers values
func NewPutFinancialStatementForbidden() *PutFinancialStatementForbidden {
	return &PutFinancialStatementForbidden{}
}

// PutFinancialStatementForbidden describes a response with status code 403, with default header values.
//
// Access forbidden, account lacks access
type PutFinancialStatementForbidden struct {
	AccessControlAllowOrigin string

	Payload *research_models.Error
}

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

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

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

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

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

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

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

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

func (o *PutFinancialStatementForbidden) GetPayload() *research_models.Error {
	return o.Payload
}

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

	// hydrates response header Access-Control-Allow-Origin
	hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")

	if hdrAccessControlAllowOrigin != "" {
		o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
	}

	o.Payload = new(research_models.Error)

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

	return nil
}

// NewPutFinancialStatementNotFound creates a PutFinancialStatementNotFound with default headers values
func NewPutFinancialStatementNotFound() *PutFinancialStatementNotFound {
	return &PutFinancialStatementNotFound{}
}

// PutFinancialStatementNotFound describes a response with status code 404, with default header values.
//
// Resource was not found
type PutFinancialStatementNotFound struct {
	AccessControlAllowOrigin string

	Payload *research_models.Error
}

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

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

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

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

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

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

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

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

func (o *PutFinancialStatementNotFound) GetPayload() *research_models.Error {
	return o.Payload
}

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

	// hydrates response header Access-Control-Allow-Origin
	hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")

	if hdrAccessControlAllowOrigin != "" {
		o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
	}

	o.Payload = new(research_models.Error)

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

	return nil
}

// NewPutFinancialStatementConflict creates a PutFinancialStatementConflict with default headers values
func NewPutFinancialStatementConflict() *PutFinancialStatementConflict {
	return &PutFinancialStatementConflict{}
}

// PutFinancialStatementConflict describes a response with status code 409, with default header values.
//
// Optimistic version conflict
type PutFinancialStatementConflict struct {
	Payload *research_models.Error
}

// IsSuccess returns true when this put financial statement conflict response has a 2xx status code
func (o *PutFinancialStatementConflict) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this put financial statement conflict response has a 3xx status code
func (o *PutFinancialStatementConflict) IsRedirect() bool {
	return false
}

// IsClientError returns true when this put financial statement conflict response has a 4xx status code
func (o *PutFinancialStatementConflict) IsClientError() bool {
	return true
}

// IsServerError returns true when this put financial statement conflict response has a 5xx status code
func (o *PutFinancialStatementConflict) IsServerError() bool {
	return false
}

// IsCode returns true when this put financial statement conflict response a status code equal to that given
func (o *PutFinancialStatementConflict) IsCode(code int) bool {
	return code == 409
}

// Code gets the status code for the put financial statement conflict response
func (o *PutFinancialStatementConflict) Code() int {
	return 409
}

func (o *PutFinancialStatementConflict) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /financialstatements][%d] putFinancialStatementConflict %s", 409, payload)
}

func (o *PutFinancialStatementConflict) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /financialstatements][%d] putFinancialStatementConflict %s", 409, payload)
}

func (o *PutFinancialStatementConflict) GetPayload() *research_models.Error {
	return o.Payload
}

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

	o.Payload = new(research_models.Error)

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

	return nil
}

// NewPutFinancialStatementUnprocessableEntity creates a PutFinancialStatementUnprocessableEntity with default headers values
func NewPutFinancialStatementUnprocessableEntity() *PutFinancialStatementUnprocessableEntity {
	return &PutFinancialStatementUnprocessableEntity{}
}

// PutFinancialStatementUnprocessableEntity describes a response with status code 422, with default header values.
//
// Unprocessable Entity, likely a bad parameter
type PutFinancialStatementUnprocessableEntity struct {
	AccessControlAllowOrigin string

	Payload *research_models.Error
}

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

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

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

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

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

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

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

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

func (o *PutFinancialStatementUnprocessableEntity) GetPayload() *research_models.Error {
	return o.Payload
}

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

	// hydrates response header Access-Control-Allow-Origin
	hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")

	if hdrAccessControlAllowOrigin != "" {
		o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
	}

	o.Payload = new(research_models.Error)

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

	return nil
}

// NewPutFinancialStatementInternalServerError creates a PutFinancialStatementInternalServerError with default headers values
func NewPutFinancialStatementInternalServerError() *PutFinancialStatementInternalServerError {
	return &PutFinancialStatementInternalServerError{}
}

// PutFinancialStatementInternalServerError describes a response with status code 500, with default header values.
//
// Server Internal Error
type PutFinancialStatementInternalServerError struct {
	AccessControlAllowOrigin string

	Payload *research_models.Error
}

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

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

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

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

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

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

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

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

func (o *PutFinancialStatementInternalServerError) GetPayload() *research_models.Error {
	return o.Payload
}

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

	// hydrates response header Access-Control-Allow-Origin
	hdrAccessControlAllowOrigin := response.GetHeader("Access-Control-Allow-Origin")

	if hdrAccessControlAllowOrigin != "" {
		o.AccessControlAllowOrigin = hdrAccessControlAllowOrigin
	}

	o.Payload = new(research_models.Error)

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

	return nil
}
