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

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

// PostCertificatesReader is a Reader for the PostCertificates structure.
type PostCertificatesReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PostCertificatesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewPostCertificatesOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewPostCertificatesUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewPostCertificatesForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewPostCertificatesNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewPostCertificatesUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPostCertificatesInternalServerError()
		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())
	}
}

// NewPostCertificatesOK creates a PostCertificatesOK with default headers values
func NewPostCertificatesOK() *PostCertificatesOK {
	return &PostCertificatesOK{}
}

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

Certificate Response Object
*/
type PostCertificatesOK struct {
	Payload *members_models.CertificateResponse
}

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

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

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

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

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

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

func (o *PostCertificatesOK) Error() string {
	return fmt.Sprintf("[POST /certificates][%d] postCertificatesOK  %+v", 200, o.Payload)
}

func (o *PostCertificatesOK) String() string {
	return fmt.Sprintf("[POST /certificates][%d] postCertificatesOK  %+v", 200, o.Payload)
}

func (o *PostCertificatesOK) GetPayload() *members_models.CertificateResponse {
	return o.Payload
}

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

	o.Payload = new(members_models.CertificateResponse)

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

	return nil
}

// NewPostCertificatesUnauthorized creates a PostCertificatesUnauthorized with default headers values
func NewPostCertificatesUnauthorized() *PostCertificatesUnauthorized {
	return &PostCertificatesUnauthorized{}
}

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

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

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

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

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

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

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

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

func (o *PostCertificatesUnauthorized) Error() string {
	return fmt.Sprintf("[POST /certificates][%d] postCertificatesUnauthorized  %+v", 401, o.Payload)
}

func (o *PostCertificatesUnauthorized) String() string {
	return fmt.Sprintf("[POST /certificates][%d] postCertificatesUnauthorized  %+v", 401, o.Payload)
}

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

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

// NewPostCertificatesForbidden creates a PostCertificatesForbidden with default headers values
func NewPostCertificatesForbidden() *PostCertificatesForbidden {
	return &PostCertificatesForbidden{}
}

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

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

	Payload *members_models.Error
}

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

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

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

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

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

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

func (o *PostCertificatesForbidden) Error() string {
	return fmt.Sprintf("[POST /certificates][%d] postCertificatesForbidden  %+v", 403, o.Payload)
}

func (o *PostCertificatesForbidden) String() string {
	return fmt.Sprintf("[POST /certificates][%d] postCertificatesForbidden  %+v", 403, o.Payload)
}

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

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

// NewPostCertificatesNotFound creates a PostCertificatesNotFound with default headers values
func NewPostCertificatesNotFound() *PostCertificatesNotFound {
	return &PostCertificatesNotFound{}
}

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

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

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

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

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

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

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

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

func (o *PostCertificatesNotFound) Error() string {
	return fmt.Sprintf("[POST /certificates][%d] postCertificatesNotFound  %+v", 404, o.Payload)
}

func (o *PostCertificatesNotFound) String() string {
	return fmt.Sprintf("[POST /certificates][%d] postCertificatesNotFound  %+v", 404, o.Payload)
}

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

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

// NewPostCertificatesUnprocessableEntity creates a PostCertificatesUnprocessableEntity with default headers values
func NewPostCertificatesUnprocessableEntity() *PostCertificatesUnprocessableEntity {
	return &PostCertificatesUnprocessableEntity{}
}

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

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

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

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

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

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

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

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

func (o *PostCertificatesUnprocessableEntity) Error() string {
	return fmt.Sprintf("[POST /certificates][%d] postCertificatesUnprocessableEntity  %+v", 422, o.Payload)
}

func (o *PostCertificatesUnprocessableEntity) String() string {
	return fmt.Sprintf("[POST /certificates][%d] postCertificatesUnprocessableEntity  %+v", 422, o.Payload)
}

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

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

// NewPostCertificatesInternalServerError creates a PostCertificatesInternalServerError with default headers values
func NewPostCertificatesInternalServerError() *PostCertificatesInternalServerError {
	return &PostCertificatesInternalServerError{}
}

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

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

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

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

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

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

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

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

func (o *PostCertificatesInternalServerError) Error() string {
	return fmt.Sprintf("[POST /certificates][%d] postCertificatesInternalServerError  %+v", 500, o.Payload)
}

func (o *PostCertificatesInternalServerError) String() string {
	return fmt.Sprintf("[POST /certificates][%d] postCertificatesInternalServerError  %+v", 500, o.Payload)
}

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

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