/*
Daytona

Daytona AI platform API Docs

API version: 1.0
Contact: support@daytona.com
*/

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

package apiclient

import (
	"encoding/json"
	"fmt"
)

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

// SnapshotManagerCredentials struct for SnapshotManagerCredentials
type SnapshotManagerCredentials struct {
	// Snapshot Manager username for the region
	Username string `json:"username"`
	// Snapshot Manager password for the region
	Password string `json:"password"`
	AdditionalProperties map[string]interface{}
}

type _SnapshotManagerCredentials SnapshotManagerCredentials

// NewSnapshotManagerCredentials instantiates a new SnapshotManagerCredentials 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 NewSnapshotManagerCredentials(username string, password string) *SnapshotManagerCredentials {
	this := SnapshotManagerCredentials{}
	this.Username = username
	this.Password = password
	return &this
}

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

// GetUsername returns the Username field value
func (o *SnapshotManagerCredentials) GetUsername() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Username
}

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

// SetUsername sets field value
func (o *SnapshotManagerCredentials) SetUsername(v string) {
	o.Username = v
}

// GetPassword returns the Password field value
func (o *SnapshotManagerCredentials) GetPassword() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Password
}

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

// SetPassword sets field value
func (o *SnapshotManagerCredentials) SetPassword(v string) {
	o.Password = v
}

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

func (o SnapshotManagerCredentials) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["username"] = o.Username
	toSerialize["password"] = o.Password

	for key, value := range o.AdditionalProperties {
		toSerialize[key] = value
	}

	return toSerialize, nil
}

func (o *SnapshotManagerCredentials) 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{
		"username",
		"password",
	}

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

	varSnapshotManagerCredentials := _SnapshotManagerCredentials{}

	err = json.Unmarshal(data, &varSnapshotManagerCredentials)

	if err != nil {
		return err
	}

	*o = SnapshotManagerCredentials(varSnapshotManagerCredentials)

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

	if err = json.Unmarshal(data, &additionalProperties); err == nil {
		delete(additionalProperties, "username")
		delete(additionalProperties, "password")
		o.AdditionalProperties = additionalProperties
	}

	return err
}

type NullableSnapshotManagerCredentials struct {
	value *SnapshotManagerCredentials
	isSet bool
}

func (v NullableSnapshotManagerCredentials) Get() *SnapshotManagerCredentials {
	return v.value
}

func (v *NullableSnapshotManagerCredentials) Set(val *SnapshotManagerCredentials) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableSnapshotManagerCredentials(val *SnapshotManagerCredentials) *NullableSnapshotManagerCredentials {
	return &NullableSnapshotManagerCredentials{value: val, isSet: true}
}

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

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


