/*
Daytona Toolbox API

Daytona Toolbox API

API version: v0.0.0-dev
*/

// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.

package toolbox

import (
	"encoding/json"
	"bytes"
	"fmt"
)

// checks if the GitCloneRequest type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &GitCloneRequest{}

// GitCloneRequest struct for GitCloneRequest
type GitCloneRequest struct {
	Branch *string `json:"branch,omitempty"`
	CommitId *string `json:"commit_id,omitempty"`
	Password *string `json:"password,omitempty"`
	Path string `json:"path"`
	Url string `json:"url"`
	Username *string `json:"username,omitempty"`
}

type _GitCloneRequest GitCloneRequest

// NewGitCloneRequest instantiates a new GitCloneRequest object
// This constructor will assign default values to properties that have it defined,
// and makes sure properties required by API are set, but the set of arguments
// will change when the set of required properties is changed
func NewGitCloneRequest(path string, url string) *GitCloneRequest {
	this := GitCloneRequest{}
	this.Path = path
	this.Url = url
	return &this
}

// NewGitCloneRequestWithDefaults instantiates a new GitCloneRequest object
// This constructor will only assign default values to properties that have it defined,
// but it doesn't guarantee that properties required by API are set
func NewGitCloneRequestWithDefaults() *GitCloneRequest {
	this := GitCloneRequest{}
	return &this
}

// GetBranch returns the Branch field value if set, zero value otherwise.
func (o *GitCloneRequest) GetBranch() string {
	if o == nil || IsNil(o.Branch) {
		var ret string
		return ret
	}
	return *o.Branch
}

// GetBranchOk returns a tuple with the Branch field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *GitCloneRequest) GetBranchOk() (*string, bool) {
	if o == nil || IsNil(o.Branch) {
		return nil, false
	}
	return o.Branch, true
}

// HasBranch returns a boolean if a field has been set.
func (o *GitCloneRequest) HasBranch() bool {
	if o != nil && !IsNil(o.Branch) {
		return true
	}

	return false
}

// SetBranch gets a reference to the given string and assigns it to the Branch field.
func (o *GitCloneRequest) SetBranch(v string) {
	o.Branch = &v
}

// GetCommitId returns the CommitId field value if set, zero value otherwise.
func (o *GitCloneRequest) GetCommitId() string {
	if o == nil || IsNil(o.CommitId) {
		var ret string
		return ret
	}
	return *o.CommitId
}

// GetCommitIdOk returns a tuple with the CommitId field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *GitCloneRequest) GetCommitIdOk() (*string, bool) {
	if o == nil || IsNil(o.CommitId) {
		return nil, false
	}
	return o.CommitId, true
}

// HasCommitId returns a boolean if a field has been set.
func (o *GitCloneRequest) HasCommitId() bool {
	if o != nil && !IsNil(o.CommitId) {
		return true
	}

	return false
}

// SetCommitId gets a reference to the given string and assigns it to the CommitId field.
func (o *GitCloneRequest) SetCommitId(v string) {
	o.CommitId = &v
}

// GetPassword returns the Password field value if set, zero value otherwise.
func (o *GitCloneRequest) GetPassword() string {
	if o == nil || IsNil(o.Password) {
		var ret string
		return ret
	}
	return *o.Password
}

// GetPasswordOk returns a tuple with the Password field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *GitCloneRequest) GetPasswordOk() (*string, bool) {
	if o == nil || IsNil(o.Password) {
		return nil, false
	}
	return o.Password, true
}

// HasPassword returns a boolean if a field has been set.
func (o *GitCloneRequest) HasPassword() bool {
	if o != nil && !IsNil(o.Password) {
		return true
	}

	return false
}

// SetPassword gets a reference to the given string and assigns it to the Password field.
func (o *GitCloneRequest) SetPassword(v string) {
	o.Password = &v
}

// GetPath returns the Path field value
func (o *GitCloneRequest) GetPath() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Path
}

// GetPathOk returns a tuple with the Path field value
// and a boolean to check if the value has been set.
func (o *GitCloneRequest) GetPathOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return &o.Path, true
}

// SetPath sets field value
func (o *GitCloneRequest) SetPath(v string) {
	o.Path = v
}

// GetUrl returns the Url field value
func (o *GitCloneRequest) GetUrl() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Url
}

// GetUrlOk returns a tuple with the Url field value
// and a boolean to check if the value has been set.
func (o *GitCloneRequest) GetUrlOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return &o.Url, true
}

// SetUrl sets field value
func (o *GitCloneRequest) SetUrl(v string) {
	o.Url = v
}

// GetUsername returns the Username field value if set, zero value otherwise.
func (o *GitCloneRequest) GetUsername() string {
	if o == nil || IsNil(o.Username) {
		var ret string
		return ret
	}
	return *o.Username
}

// GetUsernameOk returns a tuple with the Username field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *GitCloneRequest) GetUsernameOk() (*string, bool) {
	if o == nil || IsNil(o.Username) {
		return nil, false
	}
	return o.Username, true
}

// HasUsername returns a boolean if a field has been set.
func (o *GitCloneRequest) HasUsername() bool {
	if o != nil && !IsNil(o.Username) {
		return true
	}

	return false
}

// SetUsername gets a reference to the given string and assigns it to the Username field.
func (o *GitCloneRequest) SetUsername(v string) {
	o.Username = &v
}

func (o GitCloneRequest) MarshalJSON() ([]byte, error) {
	toSerialize,err := o.ToMap()
	if err != nil {
		return []byte{}, err
	}
	return json.Marshal(toSerialize)
}

func (o GitCloneRequest) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !IsNil(o.Branch) {
		toSerialize["branch"] = o.Branch
	}
	if !IsNil(o.CommitId) {
		toSerialize["commit_id"] = o.CommitId
	}
	if !IsNil(o.Password) {
		toSerialize["password"] = o.Password
	}
	toSerialize["path"] = o.Path
	toSerialize["url"] = o.Url
	if !IsNil(o.Username) {
		toSerialize["username"] = o.Username
	}
	return toSerialize, nil
}

func (o *GitCloneRequest) UnmarshalJSON(data []byte) (err error) {
	// This validates that all required properties are included in the JSON object
	// by unmarshalling the object into a generic map with string keys and checking
	// that every required field exists as a key in the generic map.
	requiredProperties := []string{
		"path",
		"url",
	}

	allProperties := make(map[string]interface{})

	err = json.Unmarshal(data, &allProperties)

	if err != nil {
		return err;
	}

	for _, requiredProperty := range(requiredProperties) {
		if _, exists := allProperties[requiredProperty]; !exists {
			return fmt.Errorf("no value given for required property %v", requiredProperty)
		}
	}

	varGitCloneRequest := _GitCloneRequest{}

	decoder := json.NewDecoder(bytes.NewReader(data))
	decoder.DisallowUnknownFields()
	err = decoder.Decode(&varGitCloneRequest)

	if err != nil {
		return err
	}

	*o = GitCloneRequest(varGitCloneRequest)

	return err
}

type NullableGitCloneRequest struct {
	value *GitCloneRequest
	isSet bool
}

func (v NullableGitCloneRequest) Get() *GitCloneRequest {
	return v.value
}

func (v *NullableGitCloneRequest) Set(val *GitCloneRequest) {
	v.value = val
	v.isSet = true
}

func (v NullableGitCloneRequest) IsSet() bool {
	return v.isSet
}

func (v *NullableGitCloneRequest) Unset() {
	v.value = nil
	v.isSet = false
}

func NewNullableGitCloneRequest(val *GitCloneRequest) *NullableGitCloneRequest {
	return &NullableGitCloneRequest{value: val, isSet: true}
}

func (v NullableGitCloneRequest) MarshalJSON() ([]byte, error) {
	return json.Marshal(v.value)
}

func (v *NullableGitCloneRequest) UnmarshalJSON(src []byte) error {
	v.isSet = true
	return json.Unmarshal(src, &v.value)
}


