/*
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"
	"time"
	"fmt"
)

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

// DockerRegistry struct for DockerRegistry
type DockerRegistry struct {
	// Registry ID
	Id string `json:"id"`
	// Registry name
	Name string `json:"name"`
	// Registry URL
	Url string `json:"url"`
	// Registry username
	Username string `json:"username"`
	// Registry project
	Project string `json:"project"`
	// Registry type
	RegistryType string `json:"registryType"`
	// Creation timestamp
	CreatedAt time.Time `json:"createdAt"`
	// Last update timestamp
	UpdatedAt time.Time `json:"updatedAt"`
	AdditionalProperties map[string]interface{}
}

type _DockerRegistry DockerRegistry

// NewDockerRegistry instantiates a new DockerRegistry 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 NewDockerRegistry(id string, name string, url string, username string, project string, registryType string, createdAt time.Time, updatedAt time.Time) *DockerRegistry {
	this := DockerRegistry{}
	this.Id = id
	this.Name = name
	this.Url = url
	this.Username = username
	this.Project = project
	this.RegistryType = registryType
	this.CreatedAt = createdAt
	this.UpdatedAt = updatedAt
	return &this
}

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

// GetId returns the Id field value
func (o *DockerRegistry) GetId() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Id
}

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

// SetId sets field value
func (o *DockerRegistry) SetId(v string) {
	o.Id = v
}

// GetName returns the Name field value
func (o *DockerRegistry) GetName() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Name
}

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

// SetName sets field value
func (o *DockerRegistry) SetName(v string) {
	o.Name = v
}

// GetUrl returns the Url field value
func (o *DockerRegistry) 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 *DockerRegistry) GetUrlOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return &o.Url, true
}

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

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

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

// GetProject returns the Project field value
func (o *DockerRegistry) 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 *DockerRegistry) GetProjectOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return &o.Project, true
}

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

// GetRegistryType returns the RegistryType field value
func (o *DockerRegistry) GetRegistryType() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.RegistryType
}

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

// SetRegistryType sets field value
func (o *DockerRegistry) SetRegistryType(v string) {
	o.RegistryType = v
}

// GetCreatedAt returns the CreatedAt field value
func (o *DockerRegistry) GetCreatedAt() time.Time {
	if o == nil {
		var ret time.Time
		return ret
	}

	return o.CreatedAt
}

// GetCreatedAtOk returns a tuple with the CreatedAt field value
// and a boolean to check if the value has been set.
func (o *DockerRegistry) GetCreatedAtOk() (*time.Time, bool) {
	if o == nil {
		return nil, false
	}
	return &o.CreatedAt, true
}

// SetCreatedAt sets field value
func (o *DockerRegistry) SetCreatedAt(v time.Time) {
	o.CreatedAt = v
}

// GetUpdatedAt returns the UpdatedAt field value
func (o *DockerRegistry) GetUpdatedAt() time.Time {
	if o == nil {
		var ret time.Time
		return ret
	}

	return o.UpdatedAt
}

// GetUpdatedAtOk returns a tuple with the UpdatedAt field value
// and a boolean to check if the value has been set.
func (o *DockerRegistry) GetUpdatedAtOk() (*time.Time, bool) {
	if o == nil {
		return nil, false
	}
	return &o.UpdatedAt, true
}

// SetUpdatedAt sets field value
func (o *DockerRegistry) SetUpdatedAt(v time.Time) {
	o.UpdatedAt = v
}

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

func (o DockerRegistry) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["id"] = o.Id
	toSerialize["name"] = o.Name
	toSerialize["url"] = o.Url
	toSerialize["username"] = o.Username
	toSerialize["project"] = o.Project
	toSerialize["registryType"] = o.RegistryType
	toSerialize["createdAt"] = o.CreatedAt
	toSerialize["updatedAt"] = o.UpdatedAt

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

	return toSerialize, nil
}

func (o *DockerRegistry) 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{
		"id",
		"name",
		"url",
		"username",
		"project",
		"registryType",
		"createdAt",
		"updatedAt",
	}

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

	varDockerRegistry := _DockerRegistry{}

	err = json.Unmarshal(data, &varDockerRegistry)

	if err != nil {
		return err
	}

	*o = DockerRegistry(varDockerRegistry)

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

	if err = json.Unmarshal(data, &additionalProperties); err == nil {
		delete(additionalProperties, "id")
		delete(additionalProperties, "name")
		delete(additionalProperties, "url")
		delete(additionalProperties, "username")
		delete(additionalProperties, "project")
		delete(additionalProperties, "registryType")
		delete(additionalProperties, "createdAt")
		delete(additionalProperties, "updatedAt")
		o.AdditionalProperties = additionalProperties
	}

	return err
}

type NullableDockerRegistry struct {
	value *DockerRegistry
	isSet bool
}

func (v NullableDockerRegistry) Get() *DockerRegistry {
	return v.value
}

func (v *NullableDockerRegistry) Set(val *DockerRegistry) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableDockerRegistry(val *DockerRegistry) *NullableDockerRegistry {
	return &NullableDockerRegistry{value: val, isSet: true}
}

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

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


