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

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

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

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

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

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

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

	for the get branch operation.

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

	/* BranchName.

	   The name of creating branch.
	*/
	BranchName string

	/* ClusterID.

	   The ID of the cluster.

	   Format: uint64
	*/
	ClusterID string

	/* ProjectID.

	   The ID of the project.

	   Format: uint64
	*/
	ProjectID string

	/* RootBranchID.

	   The id of the root branch.
	*/
	RootBranchID string

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

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

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

// WithTimeout adds the timeout to the get branch params
func (o *GetBranchParams) WithTimeout(timeout time.Duration) *GetBranchParams {
	o.SetTimeout(timeout)
	return o
}

// SetTimeout adds the timeout to the get branch params
func (o *GetBranchParams) SetTimeout(timeout time.Duration) {
	o.timeout = timeout
}

// WithContext adds the context to the get branch params
func (o *GetBranchParams) WithContext(ctx context.Context) *GetBranchParams {
	o.SetContext(ctx)
	return o
}

// SetContext adds the context to the get branch params
func (o *GetBranchParams) SetContext(ctx context.Context) {
	o.Context = ctx
}

// WithHTTPClient adds the HTTPClient to the get branch params
func (o *GetBranchParams) WithHTTPClient(client *http.Client) *GetBranchParams {
	o.SetHTTPClient(client)
	return o
}

// SetHTTPClient adds the HTTPClient to the get branch params
func (o *GetBranchParams) SetHTTPClient(client *http.Client) {
	o.HTTPClient = client
}

// WithBranchName adds the branchName to the get branch params
func (o *GetBranchParams) WithBranchName(branchName string) *GetBranchParams {
	o.SetBranchName(branchName)
	return o
}

// SetBranchName adds the branchName to the get branch params
func (o *GetBranchParams) SetBranchName(branchName string) {
	o.BranchName = branchName
}

// WithClusterID adds the clusterID to the get branch params
func (o *GetBranchParams) WithClusterID(clusterID string) *GetBranchParams {
	o.SetClusterID(clusterID)
	return o
}

// SetClusterID adds the clusterId to the get branch params
func (o *GetBranchParams) SetClusterID(clusterID string) {
	o.ClusterID = clusterID
}

// WithProjectID adds the projectID to the get branch params
func (o *GetBranchParams) WithProjectID(projectID string) *GetBranchParams {
	o.SetProjectID(projectID)
	return o
}

// SetProjectID adds the projectId to the get branch params
func (o *GetBranchParams) SetProjectID(projectID string) {
	o.ProjectID = projectID
}

// WithRootBranchID adds the rootBranchID to the get branch params
func (o *GetBranchParams) WithRootBranchID(rootBranchID string) *GetBranchParams {
	o.SetRootBranchID(rootBranchID)
	return o
}

// SetRootBranchID adds the rootBranchId to the get branch params
func (o *GetBranchParams) SetRootBranchID(rootBranchID string) {
	o.RootBranchID = rootBranchID
}

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

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

	// path param branch_name
	if err := r.SetPathParam("branch_name", o.BranchName); err != nil {
		return err
	}

	// path param cluster_id
	if err := r.SetPathParam("cluster_id", o.ClusterID); err != nil {
		return err
	}

	// path param project_id
	if err := r.SetPathParam("project_id", o.ProjectID); err != nil {
		return err
	}

	// query param root_branch_id
	qrRootBranchID := o.RootBranchID
	qRootBranchID := qrRootBranchID
	if qRootBranchID != "" {

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

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