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

package operations

import (
	"net/http"

	"github.com/go-openapi/runtime"

	custom "github.com/go-swagger/go-swagger/examples/external-types/fred"
)

/*
PutTestDefault A map of an aliased external package. Now the alias is "custom".
This response is defined as: map[string]custom.MyAlternateString

swagger:response putTestDefault
*/
type PutTestDefault struct {
	_statusCode int

	/*
	  In: Body
	*/
	Payload map[string]custom.MyAlternateString `json:"body,omitempty"`
}

// NewPutTestDefault creates PutTestDefault with default headers values
func NewPutTestDefault(code int) *PutTestDefault {
	if code <= 0 {
		code = 500
	}

	return &PutTestDefault{
		_statusCode: code,
	}
}

// WithStatusCode adds the status to the put test default response
func (o *PutTestDefault) WithStatusCode(code int) *PutTestDefault {
	o._statusCode = code
	return o
}

// SetStatusCode sets the status to the put test default response
func (o *PutTestDefault) SetStatusCode(code int) {
	o._statusCode = code
}

// WithPayload adds the payload to the put test default response
func (o *PutTestDefault) WithPayload(payload map[string]custom.MyAlternateString) *PutTestDefault {
	o.Payload = payload
	return o
}

// SetPayload sets the payload to the put test default response
func (o *PutTestDefault) SetPayload(payload map[string]custom.MyAlternateString) {
	o.Payload = payload
}

// WriteResponse to the client
func (o *PutTestDefault) WriteResponse(rw http.ResponseWriter, producer runtime.Producer) {

	rw.WriteHeader(o._statusCode)
	payload := o.Payload
	if payload == nil {
		// return empty map
		payload = make(map[string]custom.MyAlternateString, 50)
	}

	if err := producer.Produce(rw, payload); err != nil {
		panic(err) // let the recovery middleware deal with this
	}
}
