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

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"
)

// GetContractsReader is a Reader for the GetContracts structure.
type GetContractsReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetContractsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewGetContractsOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewGetContractsUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewGetContractsForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewGetContractsNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewGetContractsUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewGetContractsInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[GET /contracts] getContracts", response, response.Code())
	}
}

// NewGetContractsOK creates a GetContractsOK with default headers values
func NewGetContractsOK() *GetContractsOK {
	return &GetContractsOK{}
}

// GetContractsOK describes a response with status code 200, with default header values.
//
// Response with an array of Contract objects
type GetContractsOK struct {
	Payload *sfgate_models.ContractResponse
}

// IsSuccess returns true when this get contracts o k response has a 2xx status code
func (o *GetContractsOK) IsSuccess() bool {
	return true
}

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

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

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

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

// Code gets the status code for the get contracts o k response
func (o *GetContractsOK) Code() int {
	return 200
}

func (o *GetContractsOK) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /contracts][%d] getContractsOK %s", 200, payload)
}

func (o *GetContractsOK) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /contracts][%d] getContractsOK %s", 200, payload)
}

func (o *GetContractsOK) GetPayload() *sfgate_models.ContractResponse {
	return o.Payload
}

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

	o.Payload = new(sfgate_models.ContractResponse)

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

	return nil
}

// NewGetContractsUnauthorized creates a GetContractsUnauthorized with default headers values
func NewGetContractsUnauthorized() *GetContractsUnauthorized {
	return &GetContractsUnauthorized{}
}

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

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

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

// IsClientError returns true when this get contracts unauthorized response has a 4xx status code
func (o *GetContractsUnauthorized) IsClientError() bool {
	return true
}

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

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

// Code gets the status code for the get contracts unauthorized response
func (o *GetContractsUnauthorized) Code() int {
	return 401
}

func (o *GetContractsUnauthorized) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /contracts][%d] getContractsUnauthorized %s", 401, payload)
}

func (o *GetContractsUnauthorized) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /contracts][%d] getContractsUnauthorized %s", 401, payload)
}

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

func (o *GetContractsUnauthorized) 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
}

// NewGetContractsForbidden creates a GetContractsForbidden with default headers values
func NewGetContractsForbidden() *GetContractsForbidden {
	return &GetContractsForbidden{}
}

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

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

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

// IsClientError returns true when this get contracts forbidden response has a 4xx status code
func (o *GetContractsForbidden) IsClientError() bool {
	return true
}

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

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

// Code gets the status code for the get contracts forbidden response
func (o *GetContractsForbidden) Code() int {
	return 403
}

func (o *GetContractsForbidden) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /contracts][%d] getContractsForbidden %s", 403, payload)
}

func (o *GetContractsForbidden) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /contracts][%d] getContractsForbidden %s", 403, payload)
}

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

func (o *GetContractsForbidden) 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
}

// NewGetContractsNotFound creates a GetContractsNotFound with default headers values
func NewGetContractsNotFound() *GetContractsNotFound {
	return &GetContractsNotFound{}
}

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

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

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

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

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

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

// Code gets the status code for the get contracts not found response
func (o *GetContractsNotFound) Code() int {
	return 404
}

func (o *GetContractsNotFound) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /contracts][%d] getContractsNotFound %s", 404, payload)
}

func (o *GetContractsNotFound) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /contracts][%d] getContractsNotFound %s", 404, payload)
}

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

func (o *GetContractsNotFound) 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
}

// NewGetContractsUnprocessableEntity creates a GetContractsUnprocessableEntity with default headers values
func NewGetContractsUnprocessableEntity() *GetContractsUnprocessableEntity {
	return &GetContractsUnprocessableEntity{}
}

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

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

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

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

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

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

// Code gets the status code for the get contracts unprocessable entity response
func (o *GetContractsUnprocessableEntity) Code() int {
	return 422
}

func (o *GetContractsUnprocessableEntity) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /contracts][%d] getContractsUnprocessableEntity %s", 422, payload)
}

func (o *GetContractsUnprocessableEntity) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /contracts][%d] getContractsUnprocessableEntity %s", 422, payload)
}

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

func (o *GetContractsUnprocessableEntity) 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
}

// NewGetContractsInternalServerError creates a GetContractsInternalServerError with default headers values
func NewGetContractsInternalServerError() *GetContractsInternalServerError {
	return &GetContractsInternalServerError{}
}

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

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

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

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

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

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

// Code gets the status code for the get contracts internal server error response
func (o *GetContractsInternalServerError) Code() int {
	return 500
}

func (o *GetContractsInternalServerError) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /contracts][%d] getContractsInternalServerError %s", 500, payload)
}

func (o *GetContractsInternalServerError) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /contracts][%d] getContractsInternalServerError %s", 500, payload)
}

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

func (o *GetContractsInternalServerError) 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
}
