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

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

package emails

import (
	"context"
	"net/http"
	"time"

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

// NewGetOutgoingEmailMessagesParams creates a new GetOutgoingEmailMessagesParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewGetOutgoingEmailMessagesParams() *GetOutgoingEmailMessagesParams {
	return NewGetOutgoingEmailMessagesParamsWithTimeout(cr.DefaultTimeout)
}

// NewGetOutgoingEmailMessagesParamsWithTimeout creates a new GetOutgoingEmailMessagesParams object
// with the ability to set a timeout on a request.
func NewGetOutgoingEmailMessagesParamsWithTimeout(timeout time.Duration) *GetOutgoingEmailMessagesParams {
	return &GetOutgoingEmailMessagesParams{
		inner: innerParams{
			timeout: timeout,
		},
	}
}

// NewGetOutgoingEmailMessagesParamsWithContext creates a new GetOutgoingEmailMessagesParams object
// with the ability to set a context for a request.
//
// Deprecated: use the operation call with context to pass the context instead of [GetOutgoingEmailMessagesParams].
func NewGetOutgoingEmailMessagesParamsWithContext(ctx context.Context) *GetOutgoingEmailMessagesParams {
	return &GetOutgoingEmailMessagesParams{
		inner: innerParams{
			ctx: ctx,
		},
	}
}

// NewGetOutgoingEmailMessagesParamsWithHTTPClient creates a new GetOutgoingEmailMessagesParams object
// with the ability to set a custom HTTPClient for a request.
func NewGetOutgoingEmailMessagesParamsWithHTTPClient(client *http.Client) *GetOutgoingEmailMessagesParams {
	return &GetOutgoingEmailMessagesParams{
		HTTPClient: client,
	}
}

/*
GetOutgoingEmailMessagesParams contains all the parameters to send to the API endpoint

	for the get outgoing email messages operation.

	Typically these are written to a http.Request.
*/
type GetOutgoingEmailMessagesParams struct {

	// EmailMessageID.
	//
	// Email Message ID
	EmailMessageID *string

	// Limit.
	//
	// How many objects to return at one time
	//
	// Format: int64
	Limit *int64

	// Offset.
	//
	// How many objects to skip?
	//
	// Format: int64
	Offset *int64

	HTTPClient *http.Client

	inner innerParams
}

// WithDefaults hydrates default values in the get outgoing email messages params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetOutgoingEmailMessagesParams) WithDefaults() *GetOutgoingEmailMessagesParams {
	o.SetDefaults()
	return o
}

// SetDefaults hydrates default values in the get outgoing email messages params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetOutgoingEmailMessagesParams) SetDefaults() {
	// no default values defined for this parameter
}

// WithTimeout adds the timeout to the get outgoing email messages params.
func (o *GetOutgoingEmailMessagesParams) WithTimeout(timeout time.Duration) *GetOutgoingEmailMessagesParams {
	o.SetTimeout(timeout)
	return o
}

// SetTimeout adds the timeout to the get outgoing email messages params.
func (o *GetOutgoingEmailMessagesParams) SetTimeout(timeout time.Duration) {
	o.inner.timeout = timeout
}

// WithContext adds the context to the get outgoing email messages params.
//
// Deprecated: use the operation call with context to pass the context instead of [GetOutgoingEmailMessagesParams].
func (o *GetOutgoingEmailMessagesParams) WithContext(ctx context.Context) *GetOutgoingEmailMessagesParams {
	o.SetContext(ctx)
	return o
}

// SetContext adds the context to the get outgoing email messages params.
//
// Deprecated: use the operation call with context to pass the context instead of [GetOutgoingEmailMessagesParams].
func (o *GetOutgoingEmailMessagesParams) SetContext(ctx context.Context) {
	o.inner.ctx = ctx
}

// WithHTTPClient adds the HTTPClient to the get outgoing email messages params.
func (o *GetOutgoingEmailMessagesParams) WithHTTPClient(client *http.Client) *GetOutgoingEmailMessagesParams {
	o.SetHTTPClient(client)
	return o
}

// SetHTTPClient adds the HTTPClient to the get outgoing email messages params.
func (o *GetOutgoingEmailMessagesParams) SetHTTPClient(client *http.Client) {
	o.HTTPClient = client
}

// WithEmailMessageID adds the emailMessageID to the get outgoing email messages params.
func (o *GetOutgoingEmailMessagesParams) WithEmailMessageID(emailMessageID *string) *GetOutgoingEmailMessagesParams {
	o.SetEmailMessageID(emailMessageID)
	return o
}

// SetEmailMessageID adds the emailMessageId to the get outgoing email messages params.
func (o *GetOutgoingEmailMessagesParams) SetEmailMessageID(emailMessageID *string) {
	o.EmailMessageID = emailMessageID
}

// WithLimit adds the limit to the get outgoing email messages params.
func (o *GetOutgoingEmailMessagesParams) WithLimit(limit *int64) *GetOutgoingEmailMessagesParams {
	o.SetLimit(limit)
	return o
}

// SetLimit adds the limit to the get outgoing email messages params.
func (o *GetOutgoingEmailMessagesParams) SetLimit(limit *int64) {
	o.Limit = limit
}

// WithOffset adds the offset to the get outgoing email messages params.
func (o *GetOutgoingEmailMessagesParams) WithOffset(offset *int64) *GetOutgoingEmailMessagesParams {
	o.SetOffset(offset)
	return o
}

// SetOffset adds the offset to the get outgoing email messages params.
func (o *GetOutgoingEmailMessagesParams) SetOffset(offset *int64) {
	o.Offset = offset
}

// WriteToRequest writes these params to a [runtime.ClientRequest].
func (o *GetOutgoingEmailMessagesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
	if err := r.SetTimeout(o.inner.timeout); err != nil {
		return err
	}
	var res []error

	if o.EmailMessageID != nil {

		// query param emailMessageId
		var qrEmailMessageID string

		if o.EmailMessageID != nil {
			qrEmailMessageID = *o.EmailMessageID
		}
		qEmailMessageID := qrEmailMessageID
		if qEmailMessageID != "" {

			if err := r.SetQueryParam("emailMessageId", qEmailMessageID); err != nil {
				return err
			}
		}
	}

	if o.Limit != nil {

		// query param limit
		var qrLimit int64

		if o.Limit != nil {
			qrLimit = *o.Limit
		}
		qLimit := conv.FormatInteger(qrLimit)
		if qLimit != "" {

			if err := r.SetQueryParam("limit", qLimit); err != nil {
				return err
			}
		}
	}

	if o.Offset != nil {

		// query param offset
		var qrOffset int64

		if o.Offset != nil {
			qrOffset = *o.Offset
		}
		qOffset := conv.FormatInteger(qrOffset)
		if qOffset != "" {

			if err := r.SetQueryParam("offset", qOffset); err != nil {
				return err
			}
		}
	}

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