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

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

// PutEnrollmentsReader is a Reader for the PutEnrollments structure.
type PutEnrollmentsReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PutEnrollmentsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewPutEnrollmentsOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewPutEnrollmentsUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewPutEnrollmentsForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewPutEnrollmentsNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 409:
		result := NewPutEnrollmentsConflict()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewPutEnrollmentsUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPutEnrollmentsInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[PUT /enrollments] putEnrollments", response, response.Code())
	}
}

// NewPutEnrollmentsOK creates a PutEnrollmentsOK with default headers values
func NewPutEnrollmentsOK() *PutEnrollmentsOK {
	return &PutEnrollmentsOK{}
}

// PutEnrollmentsOK describes a response with status code 200, with default header values.
//
// Enrollment Response Object
type PutEnrollmentsOK struct {
	Payload *members_models.EnrollmentResponse
}

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

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

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

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

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

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

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

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

func (o *PutEnrollmentsOK) GetPayload() *members_models.EnrollmentResponse {
	return o.Payload
}

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

	o.Payload = new(members_models.EnrollmentResponse)

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

	return nil
}

// NewPutEnrollmentsUnauthorized creates a PutEnrollmentsUnauthorized with default headers values
func NewPutEnrollmentsUnauthorized() *PutEnrollmentsUnauthorized {
	return &PutEnrollmentsUnauthorized{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewPutEnrollmentsForbidden creates a PutEnrollmentsForbidden with default headers values
func NewPutEnrollmentsForbidden() *PutEnrollmentsForbidden {
	return &PutEnrollmentsForbidden{}
}

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

	Payload *members_models.Error
}

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

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

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

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

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

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

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

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

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

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

// NewPutEnrollmentsNotFound creates a PutEnrollmentsNotFound with default headers values
func NewPutEnrollmentsNotFound() *PutEnrollmentsNotFound {
	return &PutEnrollmentsNotFound{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewPutEnrollmentsConflict creates a PutEnrollmentsConflict with default headers values
func NewPutEnrollmentsConflict() *PutEnrollmentsConflict {
	return &PutEnrollmentsConflict{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewPutEnrollmentsUnprocessableEntity creates a PutEnrollmentsUnprocessableEntity with default headers values
func NewPutEnrollmentsUnprocessableEntity() *PutEnrollmentsUnprocessableEntity {
	return &PutEnrollmentsUnprocessableEntity{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewPutEnrollmentsInternalServerError creates a PutEnrollmentsInternalServerError with default headers values
func NewPutEnrollmentsInternalServerError() *PutEnrollmentsInternalServerError {
	return &PutEnrollmentsInternalServerError{}
}

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

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

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

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

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

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

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

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

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

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

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