// 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/sfgate/sfgate_models"
	"github.com/go-openapi/runtime"
	"github.com/go-openapi/strfmt"
)

// UpdateCourseSectionReader is a Reader for the UpdateCourseSection structure.
type UpdateCourseSectionReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *UpdateCourseSectionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewUpdateCourseSectionOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewUpdateCourseSectionUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewUpdateCourseSectionForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewUpdateCourseSectionNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewUpdateCourseSectionUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewUpdateCourseSectionInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[PUT /coursesections] updateCourseSection", response, response.Code())
	}
}

// NewUpdateCourseSectionOK creates a UpdateCourseSectionOK with default headers values
func NewUpdateCourseSectionOK() *UpdateCourseSectionOK {
	return &UpdateCourseSectionOK{}
}

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

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

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

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

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

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

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

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

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

func (o *UpdateCourseSectionOK) GetPayload() *sfgate_models.CourseSectionResponse {
	return o.Payload
}

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

	o.Payload = new(sfgate_models.CourseSectionResponse)

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

	return nil
}

// NewUpdateCourseSectionUnauthorized creates a UpdateCourseSectionUnauthorized with default headers values
func NewUpdateCourseSectionUnauthorized() *UpdateCourseSectionUnauthorized {
	return &UpdateCourseSectionUnauthorized{}
}

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

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

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

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

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

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

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

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

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

func (o *UpdateCourseSectionUnauthorized) GetPayload() *sfgate_models.Error {
	return o.Payload
}

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

	o.Payload = new(sfgate_models.Error)

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

	return nil
}

// NewUpdateCourseSectionForbidden creates a UpdateCourseSectionForbidden with default headers values
func NewUpdateCourseSectionForbidden() *UpdateCourseSectionForbidden {
	return &UpdateCourseSectionForbidden{}
}

// UpdateCourseSectionForbidden describes a response with status code 403, with default header values.
//
// Access forbidden, account lacks access
type UpdateCourseSectionForbidden struct {
	Payload *sfgate_models.Error
}

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

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

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

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

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

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

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

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

func (o *UpdateCourseSectionForbidden) GetPayload() *sfgate_models.Error {
	return o.Payload
}

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

	o.Payload = new(sfgate_models.Error)

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

	return nil
}

// NewUpdateCourseSectionNotFound creates a UpdateCourseSectionNotFound with default headers values
func NewUpdateCourseSectionNotFound() *UpdateCourseSectionNotFound {
	return &UpdateCourseSectionNotFound{}
}

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

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

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

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

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

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

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

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

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

func (o *UpdateCourseSectionNotFound) GetPayload() *sfgate_models.Error {
	return o.Payload
}

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

	o.Payload = new(sfgate_models.Error)

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

	return nil
}

// NewUpdateCourseSectionUnprocessableEntity creates a UpdateCourseSectionUnprocessableEntity with default headers values
func NewUpdateCourseSectionUnprocessableEntity() *UpdateCourseSectionUnprocessableEntity {
	return &UpdateCourseSectionUnprocessableEntity{}
}

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

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

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

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

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

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

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

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

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

func (o *UpdateCourseSectionUnprocessableEntity) GetPayload() *sfgate_models.Error {
	return o.Payload
}

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

	o.Payload = new(sfgate_models.Error)

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

	return nil
}

// NewUpdateCourseSectionInternalServerError creates a UpdateCourseSectionInternalServerError with default headers values
func NewUpdateCourseSectionInternalServerError() *UpdateCourseSectionInternalServerError {
	return &UpdateCourseSectionInternalServerError{}
}

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

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

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

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

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

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

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

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

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

func (o *UpdateCourseSectionInternalServerError) GetPayload() *sfgate_models.Error {
	return o.Payload
}

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

	o.Payload = new(sfgate_models.Error)

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

	return nil
}
