/*
 * IONOS Cloud - Network File Storage API
 *
 * The RESTful API for managing Network File Storage.
 *
 * API version: 0.1.1
 * Contact: support@cloud.ionos.com
 */

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

package ionoscloud

import (
	"encoding/json"
)

// Share A share represents a directory on a Network File Storage cluster. Options like quotas might be set for this directory.
type Share struct {
	// The directory being exported
	Name *string `json:"name"`
	// The quota in MiB for the export. The quota can restrict the amount of data that can be stored within the export. The quota can be disabled using `0`.
	Quota *int32 `json:"quota,omitempty"`
	// The group ID that will own the exported directory. If not set, **anonymous** (`512`) will be used.
	Gid *int32 `json:"gid,omitempty"`
	// The user ID that will own the exported directory. If not set, **anonymous** (`512`) will be used.
	Uid *int32 `json:"uid,omitempty"`
	// The groups of clients are the systems connecting to the Network File Storage cluster.
	ClientGroups *[]ShareClientGroups `json:"clientGroups"`
}

// NewShare instantiates a new Share 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 NewShare(name string, clientGroups []ShareClientGroups) *Share {
	this := Share{}

	this.Name = &name
	var quota int32 = 0
	this.Quota = &quota
	var gid int32 = 512
	this.Gid = &gid
	var uid int32 = 512
	this.Uid = &uid
	this.ClientGroups = &clientGroups

	return &this
}

// NewShareWithDefaults instantiates a new Share 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 NewShareWithDefaults() *Share {
	this := Share{}
	var quota int32 = 0
	this.Quota = &quota
	var gid int32 = 512
	this.Gid = &gid
	var uid int32 = 512
	this.Uid = &uid
	return &this
}

// GetName returns the Name field value
// If the value is explicit nil, the zero value for string will be returned
func (o *Share) GetName() *string {
	if o == nil {
		return nil
	}

	return o.Name

}

// GetNameOk returns a tuple with the Name field value
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *Share) GetNameOk() (*string, bool) {
	if o == nil {
		return nil, false
	}

	return o.Name, true
}

// SetName sets field value
func (o *Share) SetName(v string) {

	o.Name = &v

}

// HasName returns a boolean if a field has been set.
func (o *Share) HasName() bool {
	if o != nil && o.Name != nil {
		return true
	}

	return false
}

// GetQuota returns the Quota field value
// If the value is explicit nil, the zero value for int32 will be returned
func (o *Share) GetQuota() *int32 {
	if o == nil {
		return nil
	}

	return o.Quota

}

// GetQuotaOk returns a tuple with the Quota field value
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *Share) GetQuotaOk() (*int32, bool) {
	if o == nil {
		return nil, false
	}

	return o.Quota, true
}

// SetQuota sets field value
func (o *Share) SetQuota(v int32) {

	o.Quota = &v

}

// HasQuota returns a boolean if a field has been set.
func (o *Share) HasQuota() bool {
	if o != nil && o.Quota != nil {
		return true
	}

	return false
}

// GetGid returns the Gid field value
// If the value is explicit nil, the zero value for int32 will be returned
func (o *Share) GetGid() *int32 {
	if o == nil {
		return nil
	}

	return o.Gid

}

// GetGidOk returns a tuple with the Gid field value
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *Share) GetGidOk() (*int32, bool) {
	if o == nil {
		return nil, false
	}

	return o.Gid, true
}

// SetGid sets field value
func (o *Share) SetGid(v int32) {

	o.Gid = &v

}

// HasGid returns a boolean if a field has been set.
func (o *Share) HasGid() bool {
	if o != nil && o.Gid != nil {
		return true
	}

	return false
}

// GetUid returns the Uid field value
// If the value is explicit nil, the zero value for int32 will be returned
func (o *Share) GetUid() *int32 {
	if o == nil {
		return nil
	}

	return o.Uid

}

// GetUidOk returns a tuple with the Uid field value
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *Share) GetUidOk() (*int32, bool) {
	if o == nil {
		return nil, false
	}

	return o.Uid, true
}

// SetUid sets field value
func (o *Share) SetUid(v int32) {

	o.Uid = &v

}

// HasUid returns a boolean if a field has been set.
func (o *Share) HasUid() bool {
	if o != nil && o.Uid != nil {
		return true
	}

	return false
}

// GetClientGroups returns the ClientGroups field value
// If the value is explicit nil, the zero value for []ShareClientGroups will be returned
func (o *Share) GetClientGroups() *[]ShareClientGroups {
	if o == nil {
		return nil
	}

	return o.ClientGroups

}

// GetClientGroupsOk returns a tuple with the ClientGroups field value
// and a boolean to check if the value has been set.
// NOTE: If the value is an explicit nil, `nil, true` will be returned
func (o *Share) GetClientGroupsOk() (*[]ShareClientGroups, bool) {
	if o == nil {
		return nil, false
	}

	return o.ClientGroups, true
}

// SetClientGroups sets field value
func (o *Share) SetClientGroups(v []ShareClientGroups) {

	o.ClientGroups = &v

}

// HasClientGroups returns a boolean if a field has been set.
func (o *Share) HasClientGroups() bool {
	if o != nil && o.ClientGroups != nil {
		return true
	}

	return false
}

func (o Share) MarshalJSON() ([]byte, error) {
	toSerialize := map[string]interface{}{}
	if o.Name != nil {
		toSerialize["name"] = o.Name
	}

	if o.Quota != nil {
		toSerialize["quota"] = o.Quota
	}

	if o.Gid != nil {
		toSerialize["gid"] = o.Gid
	}

	if o.Uid != nil {
		toSerialize["uid"] = o.Uid
	}

	if o.ClientGroups != nil {
		toSerialize["clientGroups"] = o.ClientGroups
	}

	return json.Marshal(toSerialize)
}

type NullableShare struct {
	value *Share
	isSet bool
}

func (v NullableShare) Get() *Share {
	return v.value
}

func (v *NullableShare) Set(val *Share) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableShare(val *Share) *NullableShare {
	return &NullableShare{value: val, isSet: true}
}

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

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