/*
Daytona Toolbox API

Daytona Toolbox API

API version: v0.0.0-dev
*/

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

package toolbox

import (
	"encoding/json"
	"bytes"
	"fmt"
)

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

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

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

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

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

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

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

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

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

// GetSize returns the Size field value
func (o *FileInfo) GetSize() int32 {
	if o == nil {
		var ret int32
		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() (*int32, bool) {
	if o == nil {
		return nil, false
	}
	return &o.Size, true
}

// SetSize sets field value
func (o *FileInfo) SetSize(v int32) {
	o.Size = 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["group"] = o.Group
	toSerialize["isDir"] = o.IsDir
	toSerialize["modTime"] = o.ModTime
	toSerialize["mode"] = o.Mode
	toSerialize["name"] = o.Name
	toSerialize["owner"] = o.Owner
	toSerialize["permissions"] = o.Permissions
	toSerialize["size"] = o.Size
	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{
		"group",
		"isDir",
		"modTime",
		"mode",
		"name",
		"owner",
		"permissions",
		"size",
	}

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

	decoder := json.NewDecoder(bytes.NewReader(data))
	decoder.DisallowUnknownFields()
	err = decoder.Decode(&varFileInfo)

	if err != nil {
		return err
	}

	*o = FileInfo(varFileInfo)

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


