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

// FileInfo struct for FileInfo
type FileInfo struct {
	Name string `json:"name"`
	IsDir bool `json:"isDir"`
	Size float32 `json:"size"`
	ModTime string `json:"modTime"`
	Mode string `json:"mode"`
	Permissions string `json:"permissions"`
	Owner string `json:"owner"`
	Group string `json:"group"`
	AdditionalProperties map[string]interface{}
}

type _FileInfo FileInfo

// NewFileInfo instantiates a new FileInfo 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 NewFileInfo(name string, isDir bool, size float32, modTime string, mode string, permissions string, owner string, group string) *FileInfo {
	this := FileInfo{}
	this.Name = name
	this.IsDir = isDir
	this.Size = size
	this.ModTime = modTime
	this.Mode = mode
	this.Permissions = permissions
	this.Owner = owner
	this.Group = group
	return &this
}

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

// GetName returns the Name field value
func (o *FileInfo) 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 *FileInfo) GetNameOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return &o.Name, true
}

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

// GetIsDir returns the IsDir field value
func (o *FileInfo) GetIsDir() bool {
	if o == nil {
		var ret bool
		return ret
	}

	return o.IsDir
}

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

// SetIsDir sets field value
func (o *FileInfo) SetIsDir(v bool) {
	o.IsDir = v
}

// GetSize returns the Size field value
func (o *FileInfo) GetSize() float32 {
	if o == nil {
		var ret float32
		return ret
	}

	return o.Size
}

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

// SetSize sets field value
func (o *FileInfo) SetSize(v float32) {
	o.Size = v
}

// GetModTime returns the ModTime field value
func (o *FileInfo) GetModTime() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.ModTime
}

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

// SetModTime sets field value
func (o *FileInfo) SetModTime(v string) {
	o.ModTime = v
}

// GetMode returns the Mode field value
func (o *FileInfo) GetMode() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Mode
}

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

// SetMode sets field value
func (o *FileInfo) SetMode(v string) {
	o.Mode = v
}

// GetPermissions returns the Permissions field value
func (o *FileInfo) GetPermissions() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Permissions
}

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

// SetPermissions sets field value
func (o *FileInfo) SetPermissions(v string) {
	o.Permissions = v
}

// GetOwner returns the Owner field value
func (o *FileInfo) GetOwner() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Owner
}

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

// SetOwner sets field value
func (o *FileInfo) SetOwner(v string) {
	o.Owner = v
}

// GetGroup returns the Group field value
func (o *FileInfo) GetGroup() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Group
}

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

// SetGroup sets field value
func (o *FileInfo) SetGroup(v string) {
	o.Group = v
}

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

func (o FileInfo) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["name"] = o.Name
	toSerialize["isDir"] = o.IsDir
	toSerialize["size"] = o.Size
	toSerialize["modTime"] = o.ModTime
	toSerialize["mode"] = o.Mode
	toSerialize["permissions"] = o.Permissions
	toSerialize["owner"] = o.Owner
	toSerialize["group"] = o.Group

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

	return toSerialize, nil
}

func (o *FileInfo) 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{
		"name",
		"isDir",
		"size",
		"modTime",
		"mode",
		"permissions",
		"owner",
		"group",
	}

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

	varFileInfo := _FileInfo{}

	err = json.Unmarshal(data, &varFileInfo)

	if err != nil {
		return err
	}

	*o = FileInfo(varFileInfo)

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

	if err = json.Unmarshal(data, &additionalProperties); err == nil {
		delete(additionalProperties, "name")
		delete(additionalProperties, "isDir")
		delete(additionalProperties, "size")
		delete(additionalProperties, "modTime")
		delete(additionalProperties, "mode")
		delete(additionalProperties, "permissions")
		delete(additionalProperties, "owner")
		delete(additionalProperties, "group")
		o.AdditionalProperties = additionalProperties
	}

	return err
}

type NullableFileInfo struct {
	value *FileInfo
	isSet bool
}

func (v NullableFileInfo) Get() *FileInfo {
	return v.value
}

func (v *NullableFileInfo) Set(val *FileInfo) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableFileInfo(val *FileInfo) *NullableFileInfo {
	return &NullableFileInfo{value: val, isSet: true}
}

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

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


