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

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

// UpdateCoursesReader is a Reader for the UpdateCourses structure.
type UpdateCoursesReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *UpdateCoursesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewUpdateCoursesOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewUpdateCoursesUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewUpdateCoursesForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewUpdateCoursesNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 409:
		result := NewUpdateCoursesConflict()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewUpdateCoursesUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewUpdateCoursesInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[PUT /courses] updateCourses", response, response.Code())
	}
}

// NewUpdateCoursesOK creates a UpdateCoursesOK with default headers values
func NewUpdateCoursesOK() *UpdateCoursesOK {
	return &UpdateCoursesOK{}
}

// UpdateCoursesOK describes a response with status code 200, with default header values.
//
// Course Response Object
type UpdateCoursesOK struct {
	Payload *members_models.CourseResponse
}

// IsSuccess returns true when this update courses o k response has a 2xx status code
func (o *UpdateCoursesOK) IsSuccess() bool {
	return true
}

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

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

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

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

// Code gets the status code for the update courses o k response
func (o *UpdateCoursesOK) Code() int {
	return 200
}

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

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

func (o *UpdateCoursesOK) GetPayload() *members_models.CourseResponse {
	return o.Payload
}

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

	o.Payload = new(members_models.CourseResponse)

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

	return nil
}

// NewUpdateCoursesUnauthorized creates a UpdateCoursesUnauthorized with default headers values
func NewUpdateCoursesUnauthorized() *UpdateCoursesUnauthorized {
	return &UpdateCoursesUnauthorized{}
}

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

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

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

// IsClientError returns true when this update courses unauthorized response has a 4xx status code
func (o *UpdateCoursesUnauthorized) IsClientError() bool {
	return true
}

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

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

// Code gets the status code for the update courses unauthorized response
func (o *UpdateCoursesUnauthorized) Code() int {
	return 401
}

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

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

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

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

// NewUpdateCoursesForbidden creates a UpdateCoursesForbidden with default headers values
func NewUpdateCoursesForbidden() *UpdateCoursesForbidden {
	return &UpdateCoursesForbidden{}
}

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

	Payload *members_models.Error
}

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

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

// IsClientError returns true when this update courses forbidden response has a 4xx status code
func (o *UpdateCoursesForbidden) IsClientError() bool {
	return true
}

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

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

// Code gets the status code for the update courses forbidden response
func (o *UpdateCoursesForbidden) Code() int {
	return 403
}

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

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

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

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

// NewUpdateCoursesNotFound creates a UpdateCoursesNotFound with default headers values
func NewUpdateCoursesNotFound() *UpdateCoursesNotFound {
	return &UpdateCoursesNotFound{}
}

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

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

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

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

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

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

// Code gets the status code for the update courses not found response
func (o *UpdateCoursesNotFound) Code() int {
	return 404
}

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

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

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

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

// NewUpdateCoursesConflict creates a UpdateCoursesConflict with default headers values
func NewUpdateCoursesConflict() *UpdateCoursesConflict {
	return &UpdateCoursesConflict{}
}

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

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

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

// IsClientError returns true when this update courses conflict response has a 4xx status code
func (o *UpdateCoursesConflict) IsClientError() bool {
	return true
}

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

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

// Code gets the status code for the update courses conflict response
func (o *UpdateCoursesConflict) Code() int {
	return 409
}

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

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

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

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

// NewUpdateCoursesUnprocessableEntity creates a UpdateCoursesUnprocessableEntity with default headers values
func NewUpdateCoursesUnprocessableEntity() *UpdateCoursesUnprocessableEntity {
	return &UpdateCoursesUnprocessableEntity{}
}

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

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

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

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

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

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

// Code gets the status code for the update courses unprocessable entity response
func (o *UpdateCoursesUnprocessableEntity) Code() int {
	return 422
}

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

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

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

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

// NewUpdateCoursesInternalServerError creates a UpdateCoursesInternalServerError with default headers values
func NewUpdateCoursesInternalServerError() *UpdateCoursesInternalServerError {
	return &UpdateCoursesInternalServerError{}
}

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

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

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

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

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

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

// Code gets the status code for the update courses internal server error response
func (o *UpdateCoursesInternalServerError) Code() int {
	return 500
}

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

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

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

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