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

// UpdateCourseSectionsReader is a Reader for the UpdateCourseSections structure.
type UpdateCourseSectionsReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *UpdateCourseSectionsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewUpdateCourseSectionsOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewUpdateCourseSectionsUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewUpdateCourseSectionsForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewUpdateCourseSectionsNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 409:
		result := NewUpdateCourseSectionsConflict()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewUpdateCourseSectionsUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewUpdateCourseSectionsInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[PUT /coursesections] updateCourseSections", response, response.Code())
	}
}

// NewUpdateCourseSectionsOK creates a UpdateCourseSectionsOK with default headers values
func NewUpdateCourseSectionsOK() *UpdateCourseSectionsOK {
	return &UpdateCourseSectionsOK{}
}

// UpdateCourseSectionsOK describes a response with status code 200, with default header values.
//
// CourseSection Response Object
type UpdateCourseSectionsOK struct {
	Payload *members_models.CourseSectionResponse
}

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

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

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

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

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

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

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

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

func (o *UpdateCourseSectionsOK) GetPayload() *members_models.CourseSectionResponse {
	return o.Payload
}

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

	o.Payload = new(members_models.CourseSectionResponse)

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

	return nil
}

// NewUpdateCourseSectionsUnauthorized creates a UpdateCourseSectionsUnauthorized with default headers values
func NewUpdateCourseSectionsUnauthorized() *UpdateCourseSectionsUnauthorized {
	return &UpdateCourseSectionsUnauthorized{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewUpdateCourseSectionsForbidden creates a UpdateCourseSectionsForbidden with default headers values
func NewUpdateCourseSectionsForbidden() *UpdateCourseSectionsForbidden {
	return &UpdateCourseSectionsForbidden{}
}

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

	Payload *members_models.Error
}

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

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

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

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

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

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

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

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

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

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

// NewUpdateCourseSectionsNotFound creates a UpdateCourseSectionsNotFound with default headers values
func NewUpdateCourseSectionsNotFound() *UpdateCourseSectionsNotFound {
	return &UpdateCourseSectionsNotFound{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewUpdateCourseSectionsConflict creates a UpdateCourseSectionsConflict with default headers values
func NewUpdateCourseSectionsConflict() *UpdateCourseSectionsConflict {
	return &UpdateCourseSectionsConflict{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewUpdateCourseSectionsUnprocessableEntity creates a UpdateCourseSectionsUnprocessableEntity with default headers values
func NewUpdateCourseSectionsUnprocessableEntity() *UpdateCourseSectionsUnprocessableEntity {
	return &UpdateCourseSectionsUnprocessableEntity{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewUpdateCourseSectionsInternalServerError creates a UpdateCourseSectionsInternalServerError with default headers values
func NewUpdateCourseSectionsInternalServerError() *UpdateCourseSectionsInternalServerError {
	return &UpdateCourseSectionsInternalServerError{}
}

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

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

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

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

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

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

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

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

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

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

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