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

// SshAccessDto struct for SshAccessDto
type SshAccessDto struct {
	// Unique identifier for the SSH access
	Id string `json:"id"`
	// ID of the sandbox this SSH access is for
	SandboxId string `json:"sandboxId"`
	// SSH access token
	Token string `json:"token"`
	// When the SSH access expires
	ExpiresAt time.Time `json:"expiresAt"`
	// When the SSH access was created
	CreatedAt time.Time `json:"createdAt"`
	// When the SSH access was last updated
	UpdatedAt time.Time `json:"updatedAt"`
	// SSH command to connect to the sandbox
	SshCommand string `json:"sshCommand"`
	AdditionalProperties map[string]interface{}
}

type _SshAccessDto SshAccessDto

// NewSshAccessDto instantiates a new SshAccessDto 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 NewSshAccessDto(id string, sandboxId string, token string, expiresAt time.Time, createdAt time.Time, updatedAt time.Time, sshCommand string) *SshAccessDto {
	this := SshAccessDto{}
	this.Id = id
	this.SandboxId = sandboxId
	this.Token = token
	this.ExpiresAt = expiresAt
	this.CreatedAt = createdAt
	this.UpdatedAt = updatedAt
	this.SshCommand = sshCommand
	return &this
}

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

// GetId returns the Id field value
func (o *SshAccessDto) 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 *SshAccessDto) GetIdOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return &o.Id, true
}

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

// GetSandboxId returns the SandboxId field value
func (o *SshAccessDto) GetSandboxId() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.SandboxId
}

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

// SetSandboxId sets field value
func (o *SshAccessDto) SetSandboxId(v string) {
	o.SandboxId = v
}

// GetToken returns the Token field value
func (o *SshAccessDto) GetToken() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Token
}

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

// SetToken sets field value
func (o *SshAccessDto) SetToken(v string) {
	o.Token = v
}

// GetExpiresAt returns the ExpiresAt field value
func (o *SshAccessDto) GetExpiresAt() time.Time {
	if o == nil {
		var ret time.Time
		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 *SshAccessDto) GetExpiresAtOk() (*time.Time, bool) {
	if o == nil {
		return nil, false
	}
	return &o.ExpiresAt, true
}

// SetExpiresAt sets field value
func (o *SshAccessDto) SetExpiresAt(v time.Time) {
	o.ExpiresAt = v
}

// GetCreatedAt returns the CreatedAt field value
func (o *SshAccessDto) 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 *SshAccessDto) GetCreatedAtOk() (*time.Time, bool) {
	if o == nil {
		return nil, false
	}
	return &o.CreatedAt, true
}

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

// GetUpdatedAt returns the UpdatedAt field value
func (o *SshAccessDto) 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 *SshAccessDto) GetUpdatedAtOk() (*time.Time, bool) {
	if o == nil {
		return nil, false
	}
	return &o.UpdatedAt, true
}

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

// GetSshCommand returns the SshCommand field value
func (o *SshAccessDto) GetSshCommand() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.SshCommand
}

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

// SetSshCommand sets field value
func (o *SshAccessDto) SetSshCommand(v string) {
	o.SshCommand = v
}

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

func (o SshAccessDto) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["id"] = o.Id
	toSerialize["sandboxId"] = o.SandboxId
	toSerialize["token"] = o.Token
	toSerialize["expiresAt"] = o.ExpiresAt
	toSerialize["createdAt"] = o.CreatedAt
	toSerialize["updatedAt"] = o.UpdatedAt
	toSerialize["sshCommand"] = o.SshCommand

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

	return toSerialize, nil
}

func (o *SshAccessDto) 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",
		"sandboxId",
		"token",
		"expiresAt",
		"createdAt",
		"updatedAt",
		"sshCommand",
	}

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

	varSshAccessDto := _SshAccessDto{}

	err = json.Unmarshal(data, &varSshAccessDto)

	if err != nil {
		return err
	}

	*o = SshAccessDto(varSshAccessDto)

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

	if err = json.Unmarshal(data, &additionalProperties); err == nil {
		delete(additionalProperties, "id")
		delete(additionalProperties, "sandboxId")
		delete(additionalProperties, "token")
		delete(additionalProperties, "expiresAt")
		delete(additionalProperties, "createdAt")
		delete(additionalProperties, "updatedAt")
		delete(additionalProperties, "sshCommand")
		o.AdditionalProperties = additionalProperties
	}

	return err
}

type NullableSshAccessDto struct {
	value *SshAccessDto
	isSet bool
}

func (v NullableSshAccessDto) Get() *SshAccessDto {
	return v.value
}

func (v *NullableSshAccessDto) Set(val *SshAccessDto) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableSshAccessDto(val *SshAccessDto) *NullableSshAccessDto {
	return &NullableSshAccessDto{value: val, isSet: true}
}

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

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


