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

package user_interface

// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command

import (
	"net/http"
	"time"

	"golang.org/x/net/context"

	"github.com/go-openapi/errors"
	"github.com/go-openapi/runtime"
	cr "github.com/go-openapi/runtime/client"
	"github.com/go-openapi/swag"

	strfmt "github.com/go-openapi/strfmt"
)

// NewPostUIAutopilotWaypointParams creates a new PostUIAutopilotWaypointParams object
// with the default values initialized.
func NewPostUIAutopilotWaypointParams() *PostUIAutopilotWaypointParams {
	var (
		addToBeginningDefault      = bool(false)
		clearOtherWaypointsDefault = bool(false)
		datasourceDefault          = string("tranquility")
	)
	return &PostUIAutopilotWaypointParams{
		AddToBeginning:      addToBeginningDefault,
		ClearOtherWaypoints: clearOtherWaypointsDefault,
		Datasource:          &datasourceDefault,

		timeout: cr.DefaultTimeout,
	}
}

// NewPostUIAutopilotWaypointParamsWithTimeout creates a new PostUIAutopilotWaypointParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewPostUIAutopilotWaypointParamsWithTimeout(timeout time.Duration) *PostUIAutopilotWaypointParams {
	var (
		addToBeginningDefault      = bool(false)
		clearOtherWaypointsDefault = bool(false)
		datasourceDefault          = string("tranquility")
	)
	return &PostUIAutopilotWaypointParams{
		AddToBeginning:      addToBeginningDefault,
		ClearOtherWaypoints: clearOtherWaypointsDefault,
		Datasource:          &datasourceDefault,

		timeout: timeout,
	}
}

// NewPostUIAutopilotWaypointParamsWithContext creates a new PostUIAutopilotWaypointParams object
// with the default values initialized, and the ability to set a context for a request
func NewPostUIAutopilotWaypointParamsWithContext(ctx context.Context) *PostUIAutopilotWaypointParams {
	var (
		addToBeginningDefault      = bool(false)
		clearOtherWaypointsDefault = bool(false)
		datasourceDefault          = string("tranquility")
	)
	return &PostUIAutopilotWaypointParams{
		AddToBeginning:      addToBeginningDefault,
		ClearOtherWaypoints: clearOtherWaypointsDefault,
		Datasource:          &datasourceDefault,

		Context: ctx,
	}
}

// NewPostUIAutopilotWaypointParamsWithHTTPClient creates a new PostUIAutopilotWaypointParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewPostUIAutopilotWaypointParamsWithHTTPClient(client *http.Client) *PostUIAutopilotWaypointParams {
	var (
		addToBeginningDefault      = bool(false)
		clearOtherWaypointsDefault = bool(false)
		datasourceDefault          = string("tranquility")
	)
	return &PostUIAutopilotWaypointParams{
		AddToBeginning:      addToBeginningDefault,
		ClearOtherWaypoints: clearOtherWaypointsDefault,
		Datasource:          &datasourceDefault,
		HTTPClient:          client,
	}
}

/*PostUIAutopilotWaypointParams contains all the parameters to send to the API endpoint
for the post ui autopilot waypoint operation typically these are written to a http.Request
*/
type PostUIAutopilotWaypointParams struct {

	/*XUserAgent
	  Client identifier, takes precedence over User-Agent

	*/
	XUserAgent *string
	/*AddToBeginning
	  Whether this solar system should be added to the beginning of all waypoints

	*/
	AddToBeginning bool
	/*ClearOtherWaypoints
	  Whether clean other waypoints beforing adding this one

	*/
	ClearOtherWaypoints bool
	/*Datasource
	  The server name you would like data from

	*/
	Datasource *string
	/*DestinationID
	  The destination to travel to, can be solar system, station or structure's id

	*/
	DestinationID int64
	/*Token
	  Access token to use if unable to set a header

	*/
	Token *string
	/*UserAgent
	  Client identifier, takes precedence over headers

	*/
	UserAgent *string

	timeout    time.Duration
	Context    context.Context
	HTTPClient *http.Client
}

// WithTimeout adds the timeout to the post ui autopilot waypoint params
func (o *PostUIAutopilotWaypointParams) WithTimeout(timeout time.Duration) *PostUIAutopilotWaypointParams {
	o.SetTimeout(timeout)
	return o
}

// SetTimeout adds the timeout to the post ui autopilot waypoint params
func (o *PostUIAutopilotWaypointParams) SetTimeout(timeout time.Duration) {
	o.timeout = timeout
}

// WithContext adds the context to the post ui autopilot waypoint params
func (o *PostUIAutopilotWaypointParams) WithContext(ctx context.Context) *PostUIAutopilotWaypointParams {
	o.SetContext(ctx)
	return o
}

// SetContext adds the context to the post ui autopilot waypoint params
func (o *PostUIAutopilotWaypointParams) SetContext(ctx context.Context) {
	o.Context = ctx
}

// WithHTTPClient adds the HTTPClient to the post ui autopilot waypoint params
func (o *PostUIAutopilotWaypointParams) WithHTTPClient(client *http.Client) *PostUIAutopilotWaypointParams {
	o.SetHTTPClient(client)
	return o
}

// SetHTTPClient adds the HTTPClient to the post ui autopilot waypoint params
func (o *PostUIAutopilotWaypointParams) SetHTTPClient(client *http.Client) {
	o.HTTPClient = client
}

// WithXUserAgent adds the xUserAgent to the post ui autopilot waypoint params
func (o *PostUIAutopilotWaypointParams) WithXUserAgent(xUserAgent *string) *PostUIAutopilotWaypointParams {
	o.SetXUserAgent(xUserAgent)
	return o
}

// SetXUserAgent adds the xUserAgent to the post ui autopilot waypoint params
func (o *PostUIAutopilotWaypointParams) SetXUserAgent(xUserAgent *string) {
	o.XUserAgent = xUserAgent
}

// WithAddToBeginning adds the addToBeginning to the post ui autopilot waypoint params
func (o *PostUIAutopilotWaypointParams) WithAddToBeginning(addToBeginning bool) *PostUIAutopilotWaypointParams {
	o.SetAddToBeginning(addToBeginning)
	return o
}

// SetAddToBeginning adds the addToBeginning to the post ui autopilot waypoint params
func (o *PostUIAutopilotWaypointParams) SetAddToBeginning(addToBeginning bool) {
	o.AddToBeginning = addToBeginning
}

// WithClearOtherWaypoints adds the clearOtherWaypoints to the post ui autopilot waypoint params
func (o *PostUIAutopilotWaypointParams) WithClearOtherWaypoints(clearOtherWaypoints bool) *PostUIAutopilotWaypointParams {
	o.SetClearOtherWaypoints(clearOtherWaypoints)
	return o
}

// SetClearOtherWaypoints adds the clearOtherWaypoints to the post ui autopilot waypoint params
func (o *PostUIAutopilotWaypointParams) SetClearOtherWaypoints(clearOtherWaypoints bool) {
	o.ClearOtherWaypoints = clearOtherWaypoints
}

// WithDatasource adds the datasource to the post ui autopilot waypoint params
func (o *PostUIAutopilotWaypointParams) WithDatasource(datasource *string) *PostUIAutopilotWaypointParams {
	o.SetDatasource(datasource)
	return o
}

// SetDatasource adds the datasource to the post ui autopilot waypoint params
func (o *PostUIAutopilotWaypointParams) SetDatasource(datasource *string) {
	o.Datasource = datasource
}

// WithDestinationID adds the destinationID to the post ui autopilot waypoint params
func (o *PostUIAutopilotWaypointParams) WithDestinationID(destinationID int64) *PostUIAutopilotWaypointParams {
	o.SetDestinationID(destinationID)
	return o
}

// SetDestinationID adds the destinationId to the post ui autopilot waypoint params
func (o *PostUIAutopilotWaypointParams) SetDestinationID(destinationID int64) {
	o.DestinationID = destinationID
}

// WithToken adds the token to the post ui autopilot waypoint params
func (o *PostUIAutopilotWaypointParams) WithToken(token *string) *PostUIAutopilotWaypointParams {
	o.SetToken(token)
	return o
}

// SetToken adds the token to the post ui autopilot waypoint params
func (o *PostUIAutopilotWaypointParams) SetToken(token *string) {
	o.Token = token
}

// WithUserAgent adds the userAgent to the post ui autopilot waypoint params
func (o *PostUIAutopilotWaypointParams) WithUserAgent(userAgent *string) *PostUIAutopilotWaypointParams {
	o.SetUserAgent(userAgent)
	return o
}

// SetUserAgent adds the userAgent to the post ui autopilot waypoint params
func (o *PostUIAutopilotWaypointParams) SetUserAgent(userAgent *string) {
	o.UserAgent = userAgent
}

// WriteToRequest writes these params to a swagger request
func (o *PostUIAutopilotWaypointParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {

	if err := r.SetTimeout(o.timeout); err != nil {
		return err
	}
	var res []error

	if o.XUserAgent != nil {

		// header param X-User-Agent
		if err := r.SetHeaderParam("X-User-Agent", *o.XUserAgent); err != nil {
			return err
		}

	}

	// query param add_to_beginning
	qrAddToBeginning := o.AddToBeginning
	qAddToBeginning := swag.FormatBool(qrAddToBeginning)
	if qAddToBeginning != "" {
		if err := r.SetQueryParam("add_to_beginning", qAddToBeginning); err != nil {
			return err
		}
	}

	// query param clear_other_waypoints
	qrClearOtherWaypoints := o.ClearOtherWaypoints
	qClearOtherWaypoints := swag.FormatBool(qrClearOtherWaypoints)
	if qClearOtherWaypoints != "" {
		if err := r.SetQueryParam("clear_other_waypoints", qClearOtherWaypoints); err != nil {
			return err
		}
	}

	if o.Datasource != nil {

		// query param datasource
		var qrDatasource string
		if o.Datasource != nil {
			qrDatasource = *o.Datasource
		}
		qDatasource := qrDatasource
		if qDatasource != "" {
			if err := r.SetQueryParam("datasource", qDatasource); err != nil {
				return err
			}
		}

	}

	// query param destination_id
	qrDestinationID := o.DestinationID
	qDestinationID := swag.FormatInt64(qrDestinationID)
	if qDestinationID != "" {
		if err := r.SetQueryParam("destination_id", qDestinationID); err != nil {
			return err
		}
	}

	if o.Token != nil {

		// query param token
		var qrToken string
		if o.Token != nil {
			qrToken = *o.Token
		}
		qToken := qrToken
		if qToken != "" {
			if err := r.SetQueryParam("token", qToken); err != nil {
				return err
			}
		}

	}

	if o.UserAgent != nil {

		// query param user_agent
		var qrUserAgent string
		if o.UserAgent != nil {
			qrUserAgent = *o.UserAgent
		}
		qUserAgent := qrUserAgent
		if qUserAgent != "" {
			if err := r.SetQueryParam("user_agent", qUserAgent); err != nil {
				return err
			}
		}

	}

	if len(res) > 0 {
		return errors.CompositeValidationError(res...)
	}
	return nil
}
