// Code generated by go-swagger; DO NOT EDIT.

// (c) 2012-2023 by Vernon Keenan
// All rights reserved worldwide.
// Proprietary product; unlicensed use is not allowed

package courses

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

import (
	"fmt"
	"io"

	"github.com/go-openapi/runtime"
	"github.com/go-openapi/strfmt"

	"code.tnxs.net/work/lib/api/members/members_models"
)

// PostCourseSectionsReader is a Reader for the PostCourseSections structure.
type PostCourseSectionsReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PostCourseSectionsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewPostCourseSectionsOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewPostCourseSectionsUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewPostCourseSectionsForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewPostCourseSectionsNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewPostCourseSectionsUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPostCourseSectionsInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("response status code does not match any response statuses defined for this endpoint in the swagger spec", response, response.Code())
	}
}

// NewPostCourseSectionsOK creates a PostCourseSectionsOK with default headers values
func NewPostCourseSectionsOK() *PostCourseSectionsOK {
	return &PostCourseSectionsOK{}
}

/*
PostCourseSectionsOK describes a response with status code 200, with default header values.

CourseSection Response Object
*/
type PostCourseSectionsOK struct {
	Payload *members_models.CourseSectionResponse
}

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

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

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

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

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

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

func (o *PostCourseSectionsOK) Error() string {
	return fmt.Sprintf("[POST /coursesections][%d] postCourseSectionsOK  %+v", 200, o.Payload)
}

func (o *PostCourseSectionsOK) String() string {
	return fmt.Sprintf("[POST /coursesections][%d] postCourseSectionsOK  %+v", 200, o.Payload)
}

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

func (o *PostCourseSectionsOK) 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 && err != io.EOF {
		return err
	}

	return nil
}

// NewPostCourseSectionsUnauthorized creates a PostCourseSectionsUnauthorized with default headers values
func NewPostCourseSectionsUnauthorized() *PostCourseSectionsUnauthorized {
	return &PostCourseSectionsUnauthorized{}
}

/*
PostCourseSectionsUnauthorized describes a response with status code 401, with default header values.

Access Unauthorized, invalid API-KEY was used
*/
type PostCourseSectionsUnauthorized struct {
	Payload *members_models.Error
}

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

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

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

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

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

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

func (o *PostCourseSectionsUnauthorized) Error() string {
	return fmt.Sprintf("[POST /coursesections][%d] postCourseSectionsUnauthorized  %+v", 401, o.Payload)
}

func (o *PostCourseSectionsUnauthorized) String() string {
	return fmt.Sprintf("[POST /coursesections][%d] postCourseSectionsUnauthorized  %+v", 401, o.Payload)
}

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

func (o *PostCourseSectionsUnauthorized) 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 && err != io.EOF {
		return err
	}

	return nil
}

// NewPostCourseSectionsForbidden creates a PostCourseSectionsForbidden with default headers values
func NewPostCourseSectionsForbidden() *PostCourseSectionsForbidden {
	return &PostCourseSectionsForbidden{}
}

/*
PostCourseSectionsForbidden describes a response with status code 403, with default header values.

Access forbidden, account lacks access
*/
type PostCourseSectionsForbidden struct {
	AccessControlAllowOrigin string

	Payload *members_models.Error
}

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

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

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

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

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

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

func (o *PostCourseSectionsForbidden) Error() string {
	return fmt.Sprintf("[POST /coursesections][%d] postCourseSectionsForbidden  %+v", 403, o.Payload)
}

func (o *PostCourseSectionsForbidden) String() string {
	return fmt.Sprintf("[POST /coursesections][%d] postCourseSectionsForbidden  %+v", 403, o.Payload)
}

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

func (o *PostCourseSectionsForbidden) 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 && err != io.EOF {
		return err
	}

	return nil
}

// NewPostCourseSectionsNotFound creates a PostCourseSectionsNotFound with default headers values
func NewPostCourseSectionsNotFound() *PostCourseSectionsNotFound {
	return &PostCourseSectionsNotFound{}
}

/*
PostCourseSectionsNotFound describes a response with status code 404, with default header values.

Resource was not found
*/
type PostCourseSectionsNotFound struct {
	Payload *members_models.Error
}

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

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

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

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

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

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

func (o *PostCourseSectionsNotFound) Error() string {
	return fmt.Sprintf("[POST /coursesections][%d] postCourseSectionsNotFound  %+v", 404, o.Payload)
}

func (o *PostCourseSectionsNotFound) String() string {
	return fmt.Sprintf("[POST /coursesections][%d] postCourseSectionsNotFound  %+v", 404, o.Payload)
}

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

func (o *PostCourseSectionsNotFound) 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 && err != io.EOF {
		return err
	}

	return nil
}

// NewPostCourseSectionsUnprocessableEntity creates a PostCourseSectionsUnprocessableEntity with default headers values
func NewPostCourseSectionsUnprocessableEntity() *PostCourseSectionsUnprocessableEntity {
	return &PostCourseSectionsUnprocessableEntity{}
}

/*
PostCourseSectionsUnprocessableEntity describes a response with status code 422, with default header values.

Unprocessable Entity, likely a bad parameter
*/
type PostCourseSectionsUnprocessableEntity struct {
	Payload *members_models.Error
}

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

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

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

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

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

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

func (o *PostCourseSectionsUnprocessableEntity) Error() string {
	return fmt.Sprintf("[POST /coursesections][%d] postCourseSectionsUnprocessableEntity  %+v", 422, o.Payload)
}

func (o *PostCourseSectionsUnprocessableEntity) String() string {
	return fmt.Sprintf("[POST /coursesections][%d] postCourseSectionsUnprocessableEntity  %+v", 422, o.Payload)
}

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

func (o *PostCourseSectionsUnprocessableEntity) 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 && err != io.EOF {
		return err
	}

	return nil
}

// NewPostCourseSectionsInternalServerError creates a PostCourseSectionsInternalServerError with default headers values
func NewPostCourseSectionsInternalServerError() *PostCourseSectionsInternalServerError {
	return &PostCourseSectionsInternalServerError{}
}

/*
PostCourseSectionsInternalServerError describes a response with status code 500, with default header values.

Server Internal Error
*/
type PostCourseSectionsInternalServerError struct {
	Payload *members_models.Error
}

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

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

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

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

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

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

func (o *PostCourseSectionsInternalServerError) Error() string {
	return fmt.Sprintf("[POST /coursesections][%d] postCourseSectionsInternalServerError  %+v", 500, o.Payload)
}

func (o *PostCourseSectionsInternalServerError) String() string {
	return fmt.Sprintf("[POST /coursesections][%d] postCourseSectionsInternalServerError  %+v", 500, o.Payload)
}

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

func (o *PostCourseSectionsInternalServerError) 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 && err != io.EOF {
		return err
	}

	return nil
}
