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

// GetCourseSectionsReader is a Reader for the GetCourseSections structure.
type GetCourseSectionsReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetCourseSectionsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewGetCourseSectionsOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewGetCourseSectionsUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewGetCourseSectionsForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewGetCourseSectionsNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewGetCourseSectionsUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewGetCourseSectionsInternalServerError()
		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())
	}
}

// NewGetCourseSectionsOK creates a GetCourseSectionsOK with default headers values
func NewGetCourseSectionsOK() *GetCourseSectionsOK {
	return &GetCourseSectionsOK{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewGetCourseSectionsUnauthorized creates a GetCourseSectionsUnauthorized with default headers values
func NewGetCourseSectionsUnauthorized() *GetCourseSectionsUnauthorized {
	return &GetCourseSectionsUnauthorized{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewGetCourseSectionsForbidden creates a GetCourseSectionsForbidden with default headers values
func NewGetCourseSectionsForbidden() *GetCourseSectionsForbidden {
	return &GetCourseSectionsForbidden{}
}

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

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

	Payload *members_models.Error
}

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

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

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

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

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

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

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

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

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

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

// NewGetCourseSectionsNotFound creates a GetCourseSectionsNotFound with default headers values
func NewGetCourseSectionsNotFound() *GetCourseSectionsNotFound {
	return &GetCourseSectionsNotFound{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewGetCourseSectionsUnprocessableEntity creates a GetCourseSectionsUnprocessableEntity with default headers values
func NewGetCourseSectionsUnprocessableEntity() *GetCourseSectionsUnprocessableEntity {
	return &GetCourseSectionsUnprocessableEntity{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewGetCourseSectionsInternalServerError creates a GetCourseSectionsInternalServerError with default headers values
func NewGetCourseSectionsInternalServerError() *GetCourseSectionsInternalServerError {
	return &GetCourseSectionsInternalServerError{}
}

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

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

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

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

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

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

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

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

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

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

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

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