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

// UpdateCourseLessonsReader is a Reader for the UpdateCourseLessons structure.
type UpdateCourseLessonsReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *UpdateCourseLessonsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewUpdateCourseLessonsOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewUpdateCourseLessonsUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewUpdateCourseLessonsForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewUpdateCourseLessonsNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 409:
		result := NewUpdateCourseLessonsConflict()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewUpdateCourseLessonsUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewUpdateCourseLessonsInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[PUT /courselessons] updateCourseLessons", response, response.Code())
	}
}

// NewUpdateCourseLessonsOK creates a UpdateCourseLessonsOK with default headers values
func NewUpdateCourseLessonsOK() *UpdateCourseLessonsOK {
	return &UpdateCourseLessonsOK{}
}

// UpdateCourseLessonsOK describes a response with status code 200, with default header values.
//
// CourseLesson Response Object
type UpdateCourseLessonsOK struct {
	Payload *members_models.CourseLessonResponse
}

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

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

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

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

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

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

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

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

func (o *UpdateCourseLessonsOK) GetPayload() *members_models.CourseLessonResponse {
	return o.Payload
}

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

	o.Payload = new(members_models.CourseLessonResponse)

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

	return nil
}

// NewUpdateCourseLessonsUnauthorized creates a UpdateCourseLessonsUnauthorized with default headers values
func NewUpdateCourseLessonsUnauthorized() *UpdateCourseLessonsUnauthorized {
	return &UpdateCourseLessonsUnauthorized{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewUpdateCourseLessonsForbidden creates a UpdateCourseLessonsForbidden with default headers values
func NewUpdateCourseLessonsForbidden() *UpdateCourseLessonsForbidden {
	return &UpdateCourseLessonsForbidden{}
}

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

	Payload *members_models.Error
}

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

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

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

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

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

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

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

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

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

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

// NewUpdateCourseLessonsNotFound creates a UpdateCourseLessonsNotFound with default headers values
func NewUpdateCourseLessonsNotFound() *UpdateCourseLessonsNotFound {
	return &UpdateCourseLessonsNotFound{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewUpdateCourseLessonsConflict creates a UpdateCourseLessonsConflict with default headers values
func NewUpdateCourseLessonsConflict() *UpdateCourseLessonsConflict {
	return &UpdateCourseLessonsConflict{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewUpdateCourseLessonsUnprocessableEntity creates a UpdateCourseLessonsUnprocessableEntity with default headers values
func NewUpdateCourseLessonsUnprocessableEntity() *UpdateCourseLessonsUnprocessableEntity {
	return &UpdateCourseLessonsUnprocessableEntity{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewUpdateCourseLessonsInternalServerError creates a UpdateCourseLessonsInternalServerError with default headers values
func NewUpdateCourseLessonsInternalServerError() *UpdateCourseLessonsInternalServerError {
	return &UpdateCourseLessonsInternalServerError{}
}

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

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

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

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

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

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

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

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

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

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

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