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

package secret_service

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

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

// NewCompleteGitHubInstallParams creates a new CompleteGitHubInstallParams 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 NewCompleteGitHubInstallParams() *CompleteGitHubInstallParams {
	return &CompleteGitHubInstallParams{
		timeout: cr.DefaultTimeout,
	}
}

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

// NewCompleteGitHubInstallParamsWithContext creates a new CompleteGitHubInstallParams object
// with the ability to set a context for a request.
func NewCompleteGitHubInstallParamsWithContext(ctx context.Context) *CompleteGitHubInstallParams {
	return &CompleteGitHubInstallParams{
		Context: ctx,
	}
}

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

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

	for the complete git hub install operation.

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

	// Code.
	Code *string

	// InstallationID.
	//
	// Format: int64
	InstallationID *string

	// SetupAction.
	SetupAction *string

	// State.
	State *string

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

// WithDefaults hydrates default values in the complete git hub install params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *CompleteGitHubInstallParams) WithDefaults() *CompleteGitHubInstallParams {
	o.SetDefaults()
	return o
}

// SetDefaults hydrates default values in the complete git hub install params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *CompleteGitHubInstallParams) SetDefaults() {
	// no default values defined for this parameter
}

// WithTimeout adds the timeout to the complete git hub install params
func (o *CompleteGitHubInstallParams) WithTimeout(timeout time.Duration) *CompleteGitHubInstallParams {
	o.SetTimeout(timeout)
	return o
}

// SetTimeout adds the timeout to the complete git hub install params
func (o *CompleteGitHubInstallParams) SetTimeout(timeout time.Duration) {
	o.timeout = timeout
}

// WithContext adds the context to the complete git hub install params
func (o *CompleteGitHubInstallParams) WithContext(ctx context.Context) *CompleteGitHubInstallParams {
	o.SetContext(ctx)
	return o
}

// SetContext adds the context to the complete git hub install params
func (o *CompleteGitHubInstallParams) SetContext(ctx context.Context) {
	o.Context = ctx
}

// WithHTTPClient adds the HTTPClient to the complete git hub install params
func (o *CompleteGitHubInstallParams) WithHTTPClient(client *http.Client) *CompleteGitHubInstallParams {
	o.SetHTTPClient(client)
	return o
}

// SetHTTPClient adds the HTTPClient to the complete git hub install params
func (o *CompleteGitHubInstallParams) SetHTTPClient(client *http.Client) {
	o.HTTPClient = client
}

// WithCode adds the code to the complete git hub install params
func (o *CompleteGitHubInstallParams) WithCode(code *string) *CompleteGitHubInstallParams {
	o.SetCode(code)
	return o
}

// SetCode adds the code to the complete git hub install params
func (o *CompleteGitHubInstallParams) SetCode(code *string) {
	o.Code = code
}

// WithInstallationID adds the installationID to the complete git hub install params
func (o *CompleteGitHubInstallParams) WithInstallationID(installationID *string) *CompleteGitHubInstallParams {
	o.SetInstallationID(installationID)
	return o
}

// SetInstallationID adds the installationId to the complete git hub install params
func (o *CompleteGitHubInstallParams) SetInstallationID(installationID *string) {
	o.InstallationID = installationID
}

// WithSetupAction adds the setupAction to the complete git hub install params
func (o *CompleteGitHubInstallParams) WithSetupAction(setupAction *string) *CompleteGitHubInstallParams {
	o.SetSetupAction(setupAction)
	return o
}

// SetSetupAction adds the setupAction to the complete git hub install params
func (o *CompleteGitHubInstallParams) SetSetupAction(setupAction *string) {
	o.SetupAction = setupAction
}

// WithState adds the state to the complete git hub install params
func (o *CompleteGitHubInstallParams) WithState(state *string) *CompleteGitHubInstallParams {
	o.SetState(state)
	return o
}

// SetState adds the state to the complete git hub install params
func (o *CompleteGitHubInstallParams) SetState(state *string) {
	o.State = state
}

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

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

	if o.Code != nil {

		// query param code
		var qrCode string

		if o.Code != nil {
			qrCode = *o.Code
		}
		qCode := qrCode
		if qCode != "" {

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

	if o.InstallationID != nil {

		// query param installation_id
		var qrInstallationID string

		if o.InstallationID != nil {
			qrInstallationID = *o.InstallationID
		}
		qInstallationID := qrInstallationID
		if qInstallationID != "" {

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

	if o.SetupAction != nil {

		// query param setup_action
		var qrSetupAction string

		if o.SetupAction != nil {
			qrSetupAction = *o.SetupAction
		}
		qSetupAction := qrSetupAction
		if qSetupAction != "" {

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

	if o.State != nil {

		// query param state
		var qrState string

		if o.State != nil {
			qrState = *o.State
		}
		qState := qrState
		if qState != "" {

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

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