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

import (
	"encoding/json"
	stderrors "errors"
	"fmt"
	"io"

	"code.tnxs.net/vernonkeenan/lib/api/sfgate/sfgate_models"
	"github.com/go-openapi/runtime"
	"github.com/go-openapi/strfmt"
)

// PutCoursesReader is a Reader for the PutCourses structure.
type PutCoursesReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PutCoursesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (any, error) {
	switch response.Code() {
	case 200:
		result := NewPutCoursesOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewPutCoursesUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewPutCoursesForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewPutCoursesNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewPutCoursesUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPutCoursesInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	default:
		return nil, runtime.NewAPIError("[PUT /courses] putCourses", response, response.Code())
	}
}

// NewPutCoursesOK creates a PutCoursesOK with default headers values
func NewPutCoursesOK() *PutCoursesOK {
	return &PutCoursesOK{}
}

// PutCoursesOK describes a response with status code 200, with default header values.
//
// Course Response Object
type PutCoursesOK struct {
	Payload *sfgate_models.CourseResponse
}

// IsSuccess returns true when this put courses o k response has a 2xx status code
func (o *PutCoursesOK) IsSuccess() bool {
	return true
}

// IsRedirect returns true when this put courses o k response has a 3xx status code
func (o *PutCoursesOK) IsRedirect() bool {
	return false
}

// IsClientError returns true when this put courses o k response has a 4xx status code
func (o *PutCoursesOK) IsClientError() bool {
	return false
}

// IsServerError returns true when this put courses o k response has a 5xx status code
func (o *PutCoursesOK) IsServerError() bool {
	return false
}

// IsCode returns true when this put courses o k response a status code equal to that given
func (o *PutCoursesOK) IsCode(code int) bool {
	return code == 200
}

// Code gets the status code for the put courses o k response
func (o *PutCoursesOK) Code() int {
	return 200
}

func (o *PutCoursesOK) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /courses][%d] putCoursesOK %s", 200, payload)
}

func (o *PutCoursesOK) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /courses][%d] putCoursesOK %s", 200, payload)
}

func (o *PutCoursesOK) GetPayload() *sfgate_models.CourseResponse {
	return o.Payload
}

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

	o.Payload = new(sfgate_models.CourseResponse)

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

	return nil
}

// NewPutCoursesUnauthorized creates a PutCoursesUnauthorized with default headers values
func NewPutCoursesUnauthorized() *PutCoursesUnauthorized {
	return &PutCoursesUnauthorized{}
}

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

// IsSuccess returns true when this put courses unauthorized response has a 2xx status code
func (o *PutCoursesUnauthorized) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this put courses unauthorized response has a 3xx status code
func (o *PutCoursesUnauthorized) IsRedirect() bool {
	return false
}

// IsClientError returns true when this put courses unauthorized response has a 4xx status code
func (o *PutCoursesUnauthorized) IsClientError() bool {
	return true
}

// IsServerError returns true when this put courses unauthorized response has a 5xx status code
func (o *PutCoursesUnauthorized) IsServerError() bool {
	return false
}

// IsCode returns true when this put courses unauthorized response a status code equal to that given
func (o *PutCoursesUnauthorized) IsCode(code int) bool {
	return code == 401
}

// Code gets the status code for the put courses unauthorized response
func (o *PutCoursesUnauthorized) Code() int {
	return 401
}

func (o *PutCoursesUnauthorized) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /courses][%d] putCoursesUnauthorized %s", 401, payload)
}

func (o *PutCoursesUnauthorized) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /courses][%d] putCoursesUnauthorized %s", 401, payload)
}

func (o *PutCoursesUnauthorized) GetPayload() *sfgate_models.Error {
	return o.Payload
}

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

	o.Payload = new(sfgate_models.Error)

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

	return nil
}

// NewPutCoursesForbidden creates a PutCoursesForbidden with default headers values
func NewPutCoursesForbidden() *PutCoursesForbidden {
	return &PutCoursesForbidden{}
}

// PutCoursesForbidden describes a response with status code 403, with default header values.
//
// Access forbidden, account lacks access
type PutCoursesForbidden struct {
	Payload *sfgate_models.Error
}

// IsSuccess returns true when this put courses forbidden response has a 2xx status code
func (o *PutCoursesForbidden) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this put courses forbidden response has a 3xx status code
func (o *PutCoursesForbidden) IsRedirect() bool {
	return false
}

// IsClientError returns true when this put courses forbidden response has a 4xx status code
func (o *PutCoursesForbidden) IsClientError() bool {
	return true
}

// IsServerError returns true when this put courses forbidden response has a 5xx status code
func (o *PutCoursesForbidden) IsServerError() bool {
	return false
}

// IsCode returns true when this put courses forbidden response a status code equal to that given
func (o *PutCoursesForbidden) IsCode(code int) bool {
	return code == 403
}

// Code gets the status code for the put courses forbidden response
func (o *PutCoursesForbidden) Code() int {
	return 403
}

func (o *PutCoursesForbidden) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /courses][%d] putCoursesForbidden %s", 403, payload)
}

func (o *PutCoursesForbidden) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /courses][%d] putCoursesForbidden %s", 403, payload)
}

func (o *PutCoursesForbidden) GetPayload() *sfgate_models.Error {
	return o.Payload
}

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

	o.Payload = new(sfgate_models.Error)

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

	return nil
}

// NewPutCoursesNotFound creates a PutCoursesNotFound with default headers values
func NewPutCoursesNotFound() *PutCoursesNotFound {
	return &PutCoursesNotFound{}
}

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

// IsSuccess returns true when this put courses not found response has a 2xx status code
func (o *PutCoursesNotFound) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this put courses not found response has a 3xx status code
func (o *PutCoursesNotFound) IsRedirect() bool {
	return false
}

// IsClientError returns true when this put courses not found response has a 4xx status code
func (o *PutCoursesNotFound) IsClientError() bool {
	return true
}

// IsServerError returns true when this put courses not found response has a 5xx status code
func (o *PutCoursesNotFound) IsServerError() bool {
	return false
}

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

// Code gets the status code for the put courses not found response
func (o *PutCoursesNotFound) Code() int {
	return 404
}

func (o *PutCoursesNotFound) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /courses][%d] putCoursesNotFound %s", 404, payload)
}

func (o *PutCoursesNotFound) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /courses][%d] putCoursesNotFound %s", 404, payload)
}

func (o *PutCoursesNotFound) GetPayload() *sfgate_models.Error {
	return o.Payload
}

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

	o.Payload = new(sfgate_models.Error)

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

	return nil
}

// NewPutCoursesUnprocessableEntity creates a PutCoursesUnprocessableEntity with default headers values
func NewPutCoursesUnprocessableEntity() *PutCoursesUnprocessableEntity {
	return &PutCoursesUnprocessableEntity{}
}

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

// IsSuccess returns true when this put courses unprocessable entity response has a 2xx status code
func (o *PutCoursesUnprocessableEntity) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this put courses unprocessable entity response has a 3xx status code
func (o *PutCoursesUnprocessableEntity) IsRedirect() bool {
	return false
}

// IsClientError returns true when this put courses unprocessable entity response has a 4xx status code
func (o *PutCoursesUnprocessableEntity) IsClientError() bool {
	return true
}

// IsServerError returns true when this put courses unprocessable entity response has a 5xx status code
func (o *PutCoursesUnprocessableEntity) IsServerError() bool {
	return false
}

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

// Code gets the status code for the put courses unprocessable entity response
func (o *PutCoursesUnprocessableEntity) Code() int {
	return 422
}

func (o *PutCoursesUnprocessableEntity) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /courses][%d] putCoursesUnprocessableEntity %s", 422, payload)
}

func (o *PutCoursesUnprocessableEntity) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /courses][%d] putCoursesUnprocessableEntity %s", 422, payload)
}

func (o *PutCoursesUnprocessableEntity) GetPayload() *sfgate_models.Error {
	return o.Payload
}

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

	o.Payload = new(sfgate_models.Error)

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

	return nil
}

// NewPutCoursesInternalServerError creates a PutCoursesInternalServerError with default headers values
func NewPutCoursesInternalServerError() *PutCoursesInternalServerError {
	return &PutCoursesInternalServerError{}
}

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

// IsSuccess returns true when this put courses internal server error response has a 2xx status code
func (o *PutCoursesInternalServerError) IsSuccess() bool {
	return false
}

// IsRedirect returns true when this put courses internal server error response has a 3xx status code
func (o *PutCoursesInternalServerError) IsRedirect() bool {
	return false
}

// IsClientError returns true when this put courses internal server error response has a 4xx status code
func (o *PutCoursesInternalServerError) IsClientError() bool {
	return false
}

// IsServerError returns true when this put courses internal server error response has a 5xx status code
func (o *PutCoursesInternalServerError) IsServerError() bool {
	return true
}

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

// Code gets the status code for the put courses internal server error response
func (o *PutCoursesInternalServerError) Code() int {
	return 500
}

func (o *PutCoursesInternalServerError) Error() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /courses][%d] putCoursesInternalServerError %s", 500, payload)
}

func (o *PutCoursesInternalServerError) String() string {
	payload, _ := json.Marshal(o.Payload)
	return fmt.Sprintf("[PUT /courses][%d] putCoursesInternalServerError %s", 500, payload)
}

func (o *PutCoursesInternalServerError) GetPayload() *sfgate_models.Error {
	return o.Payload
}

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

	o.Payload = new(sfgate_models.Error)

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

	return nil
}
