/*
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 GitRepoRequest type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &GitRepoRequest{}

// GitRepoRequest struct for GitRepoRequest
type GitRepoRequest struct {
	Password *string `json:"password,omitempty"`
	Path string `json:"path"`
	Username *string `json:"username,omitempty"`
}

type _GitRepoRequest GitRepoRequest

// NewGitRepoRequest instantiates a new GitRepoRequest 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 NewGitRepoRequest(path string) *GitRepoRequest {
	this := GitRepoRequest{}
	this.Path = path
	return &this
}

// NewGitRepoRequestWithDefaults instantiates a new GitRepoRequest 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 NewGitRepoRequestWithDefaults() *GitRepoRequest {
	this := GitRepoRequest{}
	return &this
}

// GetPassword returns the Password field value if set, zero value otherwise.
func (o *GitRepoRequest) 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 *GitRepoRequest) 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 *GitRepoRequest) 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 *GitRepoRequest) SetPassword(v string) {
	o.Password = &v
}

// GetPath returns the Path field value
func (o *GitRepoRequest) 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 *GitRepoRequest) GetPathOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return &o.Path, true
}

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

// GetUsername returns the Username field value if set, zero value otherwise.
func (o *GitRepoRequest) 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 *GitRepoRequest) 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 *GitRepoRequest) 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 *GitRepoRequest) SetUsername(v string) {
	o.Username = &v
}

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

func (o GitRepoRequest) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !IsNil(o.Password) {
		toSerialize["password"] = o.Password
	}
	toSerialize["path"] = o.Path
	if !IsNil(o.Username) {
		toSerialize["username"] = o.Username
	}
	return toSerialize, nil
}

func (o *GitRepoRequest) 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",
	}

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

	varGitRepoRequest := _GitRepoRequest{}

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

	if err != nil {
		return err
	}

	*o = GitRepoRequest(varGitRepoRequest)

	return err
}

type NullableGitRepoRequest struct {
	value *GitRepoRequest
	isSet bool
}

func (v NullableGitRepoRequest) Get() *GitRepoRequest {
	return v.value
}

func (v *NullableGitRepoRequest) Set(val *GitRepoRequest) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableGitRepoRequest(val *GitRepoRequest) *NullableGitRepoRequest {
	return &NullableGitRepoRequest{value: val, isSet: true}
}

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

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


