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

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

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

// PutTracksReader is a Reader for the PutTracks structure.
type PutTracksReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PutTracksReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewPutTracksOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewPutTracksUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewPutTracksForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewPutTracksNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 409:
		result := NewPutTracksConflict()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewPutTracksUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPutTracksInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[PUT /tracks] putTracks", response, response.Code())
	}
}

// NewPutTracksOK creates a PutTracksOK with default headers values
func NewPutTracksOK() *PutTracksOK {
	return &PutTracksOK{}
}

// PutTracksOK describes a response with status code 200, with default header values.
//
// Governed Track response
type PutTracksOK struct {
	Payload *members_models.TrackResponse
}

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

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

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

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

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

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

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

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

func (o *PutTracksOK) GetPayload() *members_models.TrackResponse {
	return o.Payload
}

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

	o.Payload = new(members_models.TrackResponse)

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

	return nil
}

// NewPutTracksUnauthorized creates a PutTracksUnauthorized with default headers values
func NewPutTracksUnauthorized() *PutTracksUnauthorized {
	return &PutTracksUnauthorized{}
}

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

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

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

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

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

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

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

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

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

func (o *PutTracksUnauthorized) GetPayload() *members_models.Error {
	return o.Payload
}

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

	o.Payload = new(members_models.Error)

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

	return nil
}

// NewPutTracksForbidden creates a PutTracksForbidden with default headers values
func NewPutTracksForbidden() *PutTracksForbidden {
	return &PutTracksForbidden{}
}

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

	Payload *members_models.Error
}

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

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

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

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

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

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

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

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

func (o *PutTracksForbidden) GetPayload() *members_models.Error {
	return o.Payload
}

func (o *PutTracksForbidden) 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(members_models.Error)

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

	return nil
}

// NewPutTracksNotFound creates a PutTracksNotFound with default headers values
func NewPutTracksNotFound() *PutTracksNotFound {
	return &PutTracksNotFound{}
}

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

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

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

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

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

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

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

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

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

func (o *PutTracksNotFound) GetPayload() *members_models.Error {
	return o.Payload
}

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

	o.Payload = new(members_models.Error)

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

	return nil
}

// NewPutTracksConflict creates a PutTracksConflict with default headers values
func NewPutTracksConflict() *PutTracksConflict {
	return &PutTracksConflict{}
}

// PutTracksConflict describes a response with status code 409, with default header values.
//
// The supplied LastModifiedDate is stale; reload the record before retrying.
type PutTracksConflict struct {
	Payload *members_models.Error
}

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

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

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

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

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

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

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

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

func (o *PutTracksConflict) GetPayload() *members_models.Error {
	return o.Payload
}

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

	o.Payload = new(members_models.Error)

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

	return nil
}

// NewPutTracksUnprocessableEntity creates a PutTracksUnprocessableEntity with default headers values
func NewPutTracksUnprocessableEntity() *PutTracksUnprocessableEntity {
	return &PutTracksUnprocessableEntity{}
}

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

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

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

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

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

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

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

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

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

func (o *PutTracksUnprocessableEntity) GetPayload() *members_models.Error {
	return o.Payload
}

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

	o.Payload = new(members_models.Error)

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

	return nil
}

// NewPutTracksInternalServerError creates a PutTracksInternalServerError with default headers values
func NewPutTracksInternalServerError() *PutTracksInternalServerError {
	return &PutTracksInternalServerError{}
}

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

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

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

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

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

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

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

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

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

func (o *PutTracksInternalServerError) GetPayload() *members_models.Error {
	return o.Payload
}

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

	o.Payload = new(members_models.Error)

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

	return nil
}
