// 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 lesson_progress

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

// GetLessonProgressesReader is a Reader for the GetLessonProgresses structure.
type GetLessonProgressesReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *GetLessonProgressesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewGetLessonProgressesOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewGetLessonProgressesUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewGetLessonProgressesForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewGetLessonProgressesNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewGetLessonProgressesUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewGetLessonProgressesInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[GET /lessonprogress] getLessonProgresses", response, response.Code())
	}
}

// NewGetLessonProgressesOK creates a GetLessonProgressesOK with default headers values
func NewGetLessonProgressesOK() *GetLessonProgressesOK {
	return &GetLessonProgressesOK{}
}

// GetLessonProgressesOK describes a response with status code 200, with default header values.
//
// LessonProgress Response Object
type GetLessonProgressesOK struct {
	Payload *members_models.LessonProgressResponse
}

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

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

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

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

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

// Code gets the status code for the get lesson progresses o k response
func (o *GetLessonProgressesOK) Code() int {
	return 200
}

func (o *GetLessonProgressesOK) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /lessonprogress][%d] getLessonProgressesOK %s", 200, payload)
}

func (o *GetLessonProgressesOK) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /lessonprogress][%d] getLessonProgressesOK %s", 200, payload)
}

func (o *GetLessonProgressesOK) GetPayload() *members_models.LessonProgressResponse {
	return o.Payload
}

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

	o.Payload = new(members_models.LessonProgressResponse)

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

	return nil
}

// NewGetLessonProgressesUnauthorized creates a GetLessonProgressesUnauthorized with default headers values
func NewGetLessonProgressesUnauthorized() *GetLessonProgressesUnauthorized {
	return &GetLessonProgressesUnauthorized{}
}

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

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

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

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

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

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

// Code gets the status code for the get lesson progresses unauthorized response
func (o *GetLessonProgressesUnauthorized) Code() int {
	return 401
}

func (o *GetLessonProgressesUnauthorized) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /lessonprogress][%d] getLessonProgressesUnauthorized %s", 401, payload)
}

func (o *GetLessonProgressesUnauthorized) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /lessonprogress][%d] getLessonProgressesUnauthorized %s", 401, payload)
}

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

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

// NewGetLessonProgressesForbidden creates a GetLessonProgressesForbidden with default headers values
func NewGetLessonProgressesForbidden() *GetLessonProgressesForbidden {
	return &GetLessonProgressesForbidden{}
}

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

	Payload *members_models.Error
}

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

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

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

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

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

// Code gets the status code for the get lesson progresses forbidden response
func (o *GetLessonProgressesForbidden) Code() int {
	return 403
}

func (o *GetLessonProgressesForbidden) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /lessonprogress][%d] getLessonProgressesForbidden %s", 403, payload)
}

func (o *GetLessonProgressesForbidden) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /lessonprogress][%d] getLessonProgressesForbidden %s", 403, payload)
}

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

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

// NewGetLessonProgressesNotFound creates a GetLessonProgressesNotFound with default headers values
func NewGetLessonProgressesNotFound() *GetLessonProgressesNotFound {
	return &GetLessonProgressesNotFound{}
}

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

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

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

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

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

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

// Code gets the status code for the get lesson progresses not found response
func (o *GetLessonProgressesNotFound) Code() int {
	return 404
}

func (o *GetLessonProgressesNotFound) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /lessonprogress][%d] getLessonProgressesNotFound %s", 404, payload)
}

func (o *GetLessonProgressesNotFound) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /lessonprogress][%d] getLessonProgressesNotFound %s", 404, payload)
}

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

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

// NewGetLessonProgressesUnprocessableEntity creates a GetLessonProgressesUnprocessableEntity with default headers values
func NewGetLessonProgressesUnprocessableEntity() *GetLessonProgressesUnprocessableEntity {
	return &GetLessonProgressesUnprocessableEntity{}
}

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

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

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

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

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

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

// Code gets the status code for the get lesson progresses unprocessable entity response
func (o *GetLessonProgressesUnprocessableEntity) Code() int {
	return 422
}

func (o *GetLessonProgressesUnprocessableEntity) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /lessonprogress][%d] getLessonProgressesUnprocessableEntity %s", 422, payload)
}

func (o *GetLessonProgressesUnprocessableEntity) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /lessonprogress][%d] getLessonProgressesUnprocessableEntity %s", 422, payload)
}

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

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

// NewGetLessonProgressesInternalServerError creates a GetLessonProgressesInternalServerError with default headers values
func NewGetLessonProgressesInternalServerError() *GetLessonProgressesInternalServerError {
	return &GetLessonProgressesInternalServerError{}
}

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

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

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

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

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

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

// Code gets the status code for the get lesson progresses internal server error response
func (o *GetLessonProgressesInternalServerError) Code() int {
	return 500
}

func (o *GetLessonProgressesInternalServerError) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /lessonprogress][%d] getLessonProgressesInternalServerError %s", 500, payload)
}

func (o *GetLessonProgressesInternalServerError) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[GET /lessonprogress][%d] getLessonProgressesInternalServerError %s", 500, payload)
}

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

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