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

// GetCourseLessonsReader is a Reader for the GetCourseLessons structure.
type GetCourseLessonsReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetCourseLessonsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewGetCourseLessonsOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewGetCourseLessonsUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewGetCourseLessonsForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewGetCourseLessonsNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewGetCourseLessonsUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewGetCourseLessonsInternalServerError()
		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())
	}
}

// NewGetCourseLessonsOK creates a GetCourseLessonsOK with default headers values
func NewGetCourseLessonsOK() *GetCourseLessonsOK {
	return &GetCourseLessonsOK{}
}

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

CourseLesson Response Object
*/
type GetCourseLessonsOK struct {
	Payload *members_models.CourseLessonResponse
}

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

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

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

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

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

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

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

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

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

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

	return nil
}

// NewGetCourseLessonsUnauthorized creates a GetCourseLessonsUnauthorized with default headers values
func NewGetCourseLessonsUnauthorized() *GetCourseLessonsUnauthorized {
	return &GetCourseLessonsUnauthorized{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewGetCourseLessonsForbidden creates a GetCourseLessonsForbidden with default headers values
func NewGetCourseLessonsForbidden() *GetCourseLessonsForbidden {
	return &GetCourseLessonsForbidden{}
}

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

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

	Payload *members_models.Error
}

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

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

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

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

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

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

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

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

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

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

// NewGetCourseLessonsNotFound creates a GetCourseLessonsNotFound with default headers values
func NewGetCourseLessonsNotFound() *GetCourseLessonsNotFound {
	return &GetCourseLessonsNotFound{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewGetCourseLessonsUnprocessableEntity creates a GetCourseLessonsUnprocessableEntity with default headers values
func NewGetCourseLessonsUnprocessableEntity() *GetCourseLessonsUnprocessableEntity {
	return &GetCourseLessonsUnprocessableEntity{}
}

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

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

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

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

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

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

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

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

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

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

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

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

// NewGetCourseLessonsInternalServerError creates a GetCourseLessonsInternalServerError with default headers values
func NewGetCourseLessonsInternalServerError() *GetCourseLessonsInternalServerError {
	return &GetCourseLessonsInternalServerError{}
}

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

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

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

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

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

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

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

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

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

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

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

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