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

// RegistryPushAccessDto struct for RegistryPushAccessDto
type RegistryPushAccessDto struct {
	// Temporary username for registry authentication
	Username string `json:"username"`
	// Temporary secret for registry authentication
	Secret string `json:"secret"`
	// Registry URL
	RegistryUrl string `json:"registryUrl"`
	// Registry ID
	RegistryId string `json:"registryId"`
	// Registry project ID
	Project string `json:"project"`
	// Token expiration time in ISO format
	ExpiresAt string `json:"expiresAt"`
	AdditionalProperties map[string]interface{}
}

type _RegistryPushAccessDto RegistryPushAccessDto

// NewRegistryPushAccessDto instantiates a new RegistryPushAccessDto 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 NewRegistryPushAccessDto(username string, secret string, registryUrl string, registryId string, project string, expiresAt string) *RegistryPushAccessDto {
	this := RegistryPushAccessDto{}
	this.Username = username
	this.Secret = secret
	this.RegistryUrl = registryUrl
	this.RegistryId = registryId
	this.Project = project
	this.ExpiresAt = expiresAt
	return &this
}

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

// GetUsername returns the Username field value
func (o *RegistryPushAccessDto) 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 *RegistryPushAccessDto) GetUsernameOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return &o.Username, true
}

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

// GetSecret returns the Secret field value
func (o *RegistryPushAccessDto) GetSecret() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Secret
}

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

// SetSecret sets field value
func (o *RegistryPushAccessDto) SetSecret(v string) {
	o.Secret = v
}

// GetRegistryUrl returns the RegistryUrl field value
func (o *RegistryPushAccessDto) GetRegistryUrl() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.RegistryUrl
}

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

// SetRegistryUrl sets field value
func (o *RegistryPushAccessDto) SetRegistryUrl(v string) {
	o.RegistryUrl = v
}

// GetRegistryId returns the RegistryId field value
func (o *RegistryPushAccessDto) GetRegistryId() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.RegistryId
}

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

// SetRegistryId sets field value
func (o *RegistryPushAccessDto) SetRegistryId(v string) {
	o.RegistryId = v
}

// GetProject returns the Project field value
func (o *RegistryPushAccessDto) GetProject() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Project
}

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

// SetProject sets field value
func (o *RegistryPushAccessDto) SetProject(v string) {
	o.Project = v
}

// GetExpiresAt returns the ExpiresAt field value
func (o *RegistryPushAccessDto) GetExpiresAt() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.ExpiresAt
}

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

// SetExpiresAt sets field value
func (o *RegistryPushAccessDto) SetExpiresAt(v string) {
	o.ExpiresAt = v
}

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

func (o RegistryPushAccessDto) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["username"] = o.Username
	toSerialize["secret"] = o.Secret
	toSerialize["registryUrl"] = o.RegistryUrl
	toSerialize["registryId"] = o.RegistryId
	toSerialize["project"] = o.Project
	toSerialize["expiresAt"] = o.ExpiresAt

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

	return toSerialize, nil
}

func (o *RegistryPushAccessDto) 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",
		"secret",
		"registryUrl",
		"registryId",
		"project",
		"expiresAt",
	}

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

	varRegistryPushAccessDto := _RegistryPushAccessDto{}

	err = json.Unmarshal(data, &varRegistryPushAccessDto)

	if err != nil {
		return err
	}

	*o = RegistryPushAccessDto(varRegistryPushAccessDto)

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

	if err = json.Unmarshal(data, &additionalProperties); err == nil {
		delete(additionalProperties, "username")
		delete(additionalProperties, "secret")
		delete(additionalProperties, "registryUrl")
		delete(additionalProperties, "registryId")
		delete(additionalProperties, "project")
		delete(additionalProperties, "expiresAt")
		o.AdditionalProperties = additionalProperties
	}

	return err
}

type NullableRegistryPushAccessDto struct {
	value *RegistryPushAccessDto
	isSet bool
}

func (v NullableRegistryPushAccessDto) Get() *RegistryPushAccessDto {
	return v.value
}

func (v *NullableRegistryPushAccessDto) Set(val *RegistryPushAccessDto) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableRegistryPushAccessDto(val *RegistryPushAccessDto) *NullableRegistryPushAccessDto {
	return &NullableRegistryPushAccessDto{value: val, isSet: true}
}

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

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


