// Code generated by go-swagger; DO NOT EDIT.

// All Code Copyright(c) 2018-2020 by Taxnexus, Inc.
// All rights reserved worldwide.
// Proprietary product; unlicensed use is not allowed

package service

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

	"github.com/taxnexus/go/lib/api/devops/devops_models"
)

// PostServicesReader is a Reader for the PostServices structure.
type PostServicesReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PostServicesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewPostServicesOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewPostServicesUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewPostServicesForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewPostServicesNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewPostServicesUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPostServicesInternalServerError()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result

	default:
		return nil, runtime.NewAPIError("unknown error", response, response.Code())
	}
}

// NewPostServicesOK creates a PostServicesOK with default headers values
func NewPostServicesOK() *PostServicesOK {
	return &PostServicesOK{}
}

/*PostServicesOK handles this case with default header values.

Taxnexus Response with Service objects
*/
type PostServicesOK struct {
	AccessControlAllowOrigin string

	CacheControl string

	Payload *devops_models.ServiceResponse
}

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

func (o *PostServicesOK) GetPayload() *devops_models.ServiceResponse {
	return o.Payload
}

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

	// response header Access-Control-Allow-Origin
	o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin")

	// response header Cache-Control
	o.CacheControl = response.GetHeader("Cache-Control")

	o.Payload = new(devops_models.ServiceResponse)

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

	return nil
}

// NewPostServicesUnauthorized creates a PostServicesUnauthorized with default headers values
func NewPostServicesUnauthorized() *PostServicesUnauthorized {
	return &PostServicesUnauthorized{}
}

/*PostServicesUnauthorized handles this case with default header values.

Access Unauthorized, invalid API-KEY was used
*/
type PostServicesUnauthorized struct {
	AccessControlAllowOrigin string

	CacheControl string

	Payload *devops_models.Error
}

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

func (o *PostServicesUnauthorized) GetPayload() *devops_models.Error {
	return o.Payload
}

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

	// response header Access-Control-Allow-Origin
	o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin")

	// response header Cache-Control
	o.CacheControl = response.GetHeader("Cache-Control")

	o.Payload = new(devops_models.Error)

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

	return nil
}

// NewPostServicesForbidden creates a PostServicesForbidden with default headers values
func NewPostServicesForbidden() *PostServicesForbidden {
	return &PostServicesForbidden{}
}

/*PostServicesForbidden handles this case with default header values.

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

	Payload *devops_models.Error
}

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

func (o *PostServicesForbidden) GetPayload() *devops_models.Error {
	return o.Payload
}

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

	// response header Access-Control-Allow-Origin
	o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin")

	o.Payload = new(devops_models.Error)

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

	return nil
}

// NewPostServicesNotFound creates a PostServicesNotFound with default headers values
func NewPostServicesNotFound() *PostServicesNotFound {
	return &PostServicesNotFound{}
}

/*PostServicesNotFound handles this case with default header values.

Resource was not found
*/
type PostServicesNotFound struct {
	AccessControlAllowOrigin string

	Payload *devops_models.Error
}

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

func (o *PostServicesNotFound) GetPayload() *devops_models.Error {
	return o.Payload
}

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

	// response header Access-Control-Allow-Origin
	o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin")

	o.Payload = new(devops_models.Error)

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

	return nil
}

// NewPostServicesUnprocessableEntity creates a PostServicesUnprocessableEntity with default headers values
func NewPostServicesUnprocessableEntity() *PostServicesUnprocessableEntity {
	return &PostServicesUnprocessableEntity{}
}

/*PostServicesUnprocessableEntity handles this case with default header values.

Unprocessable Entity, likely a bad parameter
*/
type PostServicesUnprocessableEntity struct {
	AccessControlAllowOrigin string

	CacheControl string

	Payload *devops_models.Error
}

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

func (o *PostServicesUnprocessableEntity) GetPayload() *devops_models.Error {
	return o.Payload
}

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

	// response header Access-Control-Allow-Origin
	o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin")

	// response header Cache-Control
	o.CacheControl = response.GetHeader("Cache-Control")

	o.Payload = new(devops_models.Error)

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

	return nil
}

// NewPostServicesInternalServerError creates a PostServicesInternalServerError with default headers values
func NewPostServicesInternalServerError() *PostServicesInternalServerError {
	return &PostServicesInternalServerError{}
}

/*PostServicesInternalServerError handles this case with default header values.

Server Internal Error
*/
type PostServicesInternalServerError struct {
	AccessControlAllowOrigin string

	Payload *devops_models.Error
}

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

func (o *PostServicesInternalServerError) GetPayload() *devops_models.Error {
	return o.Payload
}

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

	// response header Access-Control-Allow-Origin
	o.AccessControlAllowOrigin = response.GetHeader("Access-Control-Allow-Origin")

	o.Payload = new(devops_models.Error)

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

	return nil
}
