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

// PostLessonProgressesReader is a Reader for the PostLessonProgresses structure.
type PostLessonProgressesReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PostLessonProgressesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewPostLessonProgressesOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewPostLessonProgressesUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewPostLessonProgressesForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewPostLessonProgressesNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewPostLessonProgressesUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPostLessonProgressesInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[POST /lessonprogress] postLessonProgresses", response, response.Code())
	}
}

// NewPostLessonProgressesOK creates a PostLessonProgressesOK with default headers values
func NewPostLessonProgressesOK() *PostLessonProgressesOK {
	return &PostLessonProgressesOK{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewPostLessonProgressesUnauthorized creates a PostLessonProgressesUnauthorized with default headers values
func NewPostLessonProgressesUnauthorized() *PostLessonProgressesUnauthorized {
	return &PostLessonProgressesUnauthorized{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewPostLessonProgressesForbidden creates a PostLessonProgressesForbidden with default headers values
func NewPostLessonProgressesForbidden() *PostLessonProgressesForbidden {
	return &PostLessonProgressesForbidden{}
}

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

	Payload *members_models.Error
}

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

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

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

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

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

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

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

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

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

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

// NewPostLessonProgressesNotFound creates a PostLessonProgressesNotFound with default headers values
func NewPostLessonProgressesNotFound() *PostLessonProgressesNotFound {
	return &PostLessonProgressesNotFound{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewPostLessonProgressesUnprocessableEntity creates a PostLessonProgressesUnprocessableEntity with default headers values
func NewPostLessonProgressesUnprocessableEntity() *PostLessonProgressesUnprocessableEntity {
	return &PostLessonProgressesUnprocessableEntity{}
}

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

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

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

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

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

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

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

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

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

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

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

// NewPostLessonProgressesInternalServerError creates a PostLessonProgressesInternalServerError with default headers values
func NewPostLessonProgressesInternalServerError() *PostLessonProgressesInternalServerError {
	return &PostLessonProgressesInternalServerError{}
}

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

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

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

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

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

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

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

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

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

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

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