/*
1Backend

AI-native microservices platform.

API version: 0.8.2
Contact: sales@singulatron.com
*/

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

package openapi

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

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

// ContainerSvcKeep struct for ContainerSvcKeep
type ContainerSvcKeep struct {
	// Path is the absolute path inside the container for the folder that should persist across restarts.
	Path string `json:"path"`
	// ReadOnly indicates whether the keep is read-only.
	ReadOnly *bool `json:"readOnly,omitempty"`
}

type _ContainerSvcKeep ContainerSvcKeep

// NewContainerSvcKeep instantiates a new ContainerSvcKeep 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 NewContainerSvcKeep(path string) *ContainerSvcKeep {
	this := ContainerSvcKeep{}
	this.Path = path
	return &this
}

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

// GetPath returns the Path field value
func (o *ContainerSvcKeep) GetPath() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Path
}

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

// SetPath sets field value
func (o *ContainerSvcKeep) SetPath(v string) {
	o.Path = v
}

// GetReadOnly returns the ReadOnly field value if set, zero value otherwise.
func (o *ContainerSvcKeep) GetReadOnly() bool {
	if o == nil || IsNil(o.ReadOnly) {
		var ret bool
		return ret
	}
	return *o.ReadOnly
}

// GetReadOnlyOk returns a tuple with the ReadOnly field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *ContainerSvcKeep) GetReadOnlyOk() (*bool, bool) {
	if o == nil || IsNil(o.ReadOnly) {
		return nil, false
	}
	return o.ReadOnly, true
}

// HasReadOnly returns a boolean if a field has been set.
func (o *ContainerSvcKeep) HasReadOnly() bool {
	if o != nil && !IsNil(o.ReadOnly) {
		return true
	}

	return false
}

// SetReadOnly gets a reference to the given bool and assigns it to the ReadOnly field.
func (o *ContainerSvcKeep) SetReadOnly(v bool) {
	o.ReadOnly = &v
}

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

func (o ContainerSvcKeep) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["path"] = o.Path
	if !IsNil(o.ReadOnly) {
		toSerialize["readOnly"] = o.ReadOnly
	}
	return toSerialize, nil
}

func (o *ContainerSvcKeep) 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{
		"path",
	}

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

	varContainerSvcKeep := _ContainerSvcKeep{}

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

	if err != nil {
		return err
	}

	*o = ContainerSvcKeep(varContainerSvcKeep)

	return err
}

type NullableContainerSvcKeep struct {
	value *ContainerSvcKeep
	isSet bool
}

func (v NullableContainerSvcKeep) Get() *ContainerSvcKeep {
	return v.value
}

func (v *NullableContainerSvcKeep) Set(val *ContainerSvcKeep) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableContainerSvcKeep(val *ContainerSvcKeep) *NullableContainerSvcKeep {
	return &NullableContainerSvcKeep{value: val, isSet: true}
}

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

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


