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

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

// PostDomainsReader is a Reader for the PostDomains structure.
type PostDomainsReader struct {
	formats strfmt.Registry
}

// ReadResponse reads a server response into the received o.
func (o *PostDomainsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) {
	switch response.Code() {
	case 200:
		result := NewPostDomainsOK()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return result, nil
	case 401:
		result := NewPostDomainsUnauthorized()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 403:
		result := NewPostDomainsForbidden()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 404:
		result := NewPostDomainsNotFound()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 422:
		result := NewPostDomainsUnprocessableEntity()
		if err := result.readResponse(response, consumer, o.formats); err != nil {
			return nil, err
		}
		return nil, result
	case 500:
		result := NewPostDomainsInternalServerError()
		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())
	}
}

// NewPostDomainsOK creates a PostDomainsOK with default headers values
func NewPostDomainsOK() *PostDomainsOK {
	return &PostDomainsOK{}
}

/*PostDomainsOK handles this case with default header values.

Taxnexus Response with an array of Domain objects
*/
type PostDomainsOK struct {
	AccessControlAllowOrigin string

	CacheControl string

	Payload *geo_models.DomainResponse
}

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

func (o *PostDomainsOK) GetPayload() *geo_models.DomainResponse {
	return o.Payload
}

func (o *PostDomainsOK) 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(geo_models.DomainResponse)

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

	return nil
}

// NewPostDomainsUnauthorized creates a PostDomainsUnauthorized with default headers values
func NewPostDomainsUnauthorized() *PostDomainsUnauthorized {
	return &PostDomainsUnauthorized{}
}

/*PostDomainsUnauthorized handles this case with default header values.

Access unauthorized, invalid API-KEY was used
*/
type PostDomainsUnauthorized struct {
	AccessControlAllowOrigin string

	Payload *geo_models.Error
}

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

func (o *PostDomainsUnauthorized) GetPayload() *geo_models.Error {
	return o.Payload
}

func (o *PostDomainsUnauthorized) 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(geo_models.Error)

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

	return nil
}

// NewPostDomainsForbidden creates a PostDomainsForbidden with default headers values
func NewPostDomainsForbidden() *PostDomainsForbidden {
	return &PostDomainsForbidden{}
}

/*PostDomainsForbidden handles this case with default header values.

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

	Payload *geo_models.Error
}

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

func (o *PostDomainsForbidden) GetPayload() *geo_models.Error {
	return o.Payload
}

func (o *PostDomainsForbidden) 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(geo_models.Error)

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

	return nil
}

// NewPostDomainsNotFound creates a PostDomainsNotFound with default headers values
func NewPostDomainsNotFound() *PostDomainsNotFound {
	return &PostDomainsNotFound{}
}

/*PostDomainsNotFound handles this case with default header values.

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

	Payload *geo_models.Error
}

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

func (o *PostDomainsNotFound) GetPayload() *geo_models.Error {
	return o.Payload
}

func (o *PostDomainsNotFound) 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(geo_models.Error)

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

	return nil
}

// NewPostDomainsUnprocessableEntity creates a PostDomainsUnprocessableEntity with default headers values
func NewPostDomainsUnprocessableEntity() *PostDomainsUnprocessableEntity {
	return &PostDomainsUnprocessableEntity{}
}

/*PostDomainsUnprocessableEntity handles this case with default header values.

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

	Payload *geo_models.Error
}

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

func (o *PostDomainsUnprocessableEntity) GetPayload() *geo_models.Error {
	return o.Payload
}

func (o *PostDomainsUnprocessableEntity) 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(geo_models.Error)

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

	return nil
}

// NewPostDomainsInternalServerError creates a PostDomainsInternalServerError with default headers values
func NewPostDomainsInternalServerError() *PostDomainsInternalServerError {
	return &PostDomainsInternalServerError{}
}

/*PostDomainsInternalServerError handles this case with default header values.

Server Internal Error
*/
type PostDomainsInternalServerError struct {
	AccessControlAllowOrigin string

	Payload *geo_models.Error
}

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

func (o *PostDomainsInternalServerError) GetPayload() *geo_models.Error {
	return o.Payload
}

func (o *PostDomainsInternalServerError) 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(geo_models.Error)

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

	return nil
}
