/*
Libre Graph API

Libre Graph is a free API for cloud collaboration inspired by the MS Graph API.

API version: v1.0.4
*/

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

package libregraph

import (
	"encoding/json"
)

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

// CollectionOfPermissionsWithAllowedValues struct for CollectionOfPermissionsWithAllowedValues
type CollectionOfPermissionsWithAllowedValues struct {
	// A list of role definitions that can be chosen for the resource.
	LibreGraphPermissionsRolesAllowedValues []UnifiedRoleDefinition `json:"@libre.graph.permissions.roles.allowedValues,omitempty"`
	// A list of actions that can be chosen for a custom role.  Following the CS3 API we can represent the CS3 permissions by mapping them to driveItem properties or relations like this: | [CS3 ResourcePermission](https://cs3org.github.io/cs3apis/#cs3.storage.provider.v1beta1.ResourcePermissions) | action | comment | | ------------------------------------------------------------------------------------------------------------ | ------ | ------- | | `stat` | `libre.graph/driveItem/basic/read` | `basic` because it does not include versions or trashed items | | `get_quota` | `libre.graph/driveItem/quota/read` | read only the `quota` property | | `get_path` | `libre.graph/driveItem/path/read` | read only the `path` property | | `move` | `libre.graph/driveItem/path/update` | allows updating the `path` property of a CS3 resource | | `delete` | `libre.graph/driveItem/standard/delete` | `standard` because deleting is a common update operation | | `list_container` | `libre.graph/driveItem/children/read` | | | `create_container` | `libre.graph/driveItem/children/create` | | | `initiate_file_download` | `libre.graph/driveItem/content/read` | `content` is the property read when initiating a download | | `initiate_file_upload` | `libre.graph/driveItem/upload/create` | `uploads` are a separate property. postprocessing creates the `content` | | `add_grant` | `libre.graph/driveItem/permissions/create` | | | `list_grant` | `libre.graph/driveItem/permissions/read` | | | `update_grant` | `libre.graph/driveItem/permissions/update` | | | `remove_grant` | `libre.graph/driveItem/permissions/delete` | | | `deny_grant` | `libre.graph/driveItem/permissions/deny` | uses a non CRUD action `deny` | | `list_file_versions` | `libre.graph/driveItem/versions/read` | `versions` is a `driveItemVersion` collection | | `restore_file_version` | `libre.graph/driveItem/versions/update` | the only `update` action is restore | | `list_recycle` | `libre.graph/driveItem/deleted/read` | reading a driveItem `deleted` property implies listing | | `restore_recycle_item` | `libre.graph/driveItem/deleted/update` | the only `update` action is restore | | `purge_recycle` | `libre.graph/driveItem/deleted/delete` | allows purging deleted `driveItems` |
	LibreGraphPermissionsActionsAllowedValues []string     `json:"@libre.graph.permissions.actions.allowedValues,omitempty"`
	Value                                     []Permission `json:"value,omitempty"`
}

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

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

// GetLibreGraphPermissionsRolesAllowedValues returns the LibreGraphPermissionsRolesAllowedValues field value if set, zero value otherwise.
func (o *CollectionOfPermissionsWithAllowedValues) GetLibreGraphPermissionsRolesAllowedValues() []UnifiedRoleDefinition {
	if o == nil || IsNil(o.LibreGraphPermissionsRolesAllowedValues) {
		var ret []UnifiedRoleDefinition
		return ret
	}
	return o.LibreGraphPermissionsRolesAllowedValues
}

// GetLibreGraphPermissionsRolesAllowedValuesOk returns a tuple with the LibreGraphPermissionsRolesAllowedValues field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CollectionOfPermissionsWithAllowedValues) GetLibreGraphPermissionsRolesAllowedValuesOk() ([]UnifiedRoleDefinition, bool) {
	if o == nil || IsNil(o.LibreGraphPermissionsRolesAllowedValues) {
		return nil, false
	}
	return o.LibreGraphPermissionsRolesAllowedValues, true
}

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

	return false
}

// SetLibreGraphPermissionsRolesAllowedValues gets a reference to the given []UnifiedRoleDefinition and assigns it to the LibreGraphPermissionsRolesAllowedValues field.
func (o *CollectionOfPermissionsWithAllowedValues) SetLibreGraphPermissionsRolesAllowedValues(v []UnifiedRoleDefinition) {
	o.LibreGraphPermissionsRolesAllowedValues = v
}

// GetLibreGraphPermissionsActionsAllowedValues returns the LibreGraphPermissionsActionsAllowedValues field value if set, zero value otherwise.
func (o *CollectionOfPermissionsWithAllowedValues) GetLibreGraphPermissionsActionsAllowedValues() []string {
	if o == nil || IsNil(o.LibreGraphPermissionsActionsAllowedValues) {
		var ret []string
		return ret
	}
	return o.LibreGraphPermissionsActionsAllowedValues
}

// GetLibreGraphPermissionsActionsAllowedValuesOk returns a tuple with the LibreGraphPermissionsActionsAllowedValues field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CollectionOfPermissionsWithAllowedValues) GetLibreGraphPermissionsActionsAllowedValuesOk() ([]string, bool) {
	if o == nil || IsNil(o.LibreGraphPermissionsActionsAllowedValues) {
		return nil, false
	}
	return o.LibreGraphPermissionsActionsAllowedValues, true
}

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

	return false
}

// SetLibreGraphPermissionsActionsAllowedValues gets a reference to the given []string and assigns it to the LibreGraphPermissionsActionsAllowedValues field.
func (o *CollectionOfPermissionsWithAllowedValues) SetLibreGraphPermissionsActionsAllowedValues(v []string) {
	o.LibreGraphPermissionsActionsAllowedValues = v
}

// GetValue returns the Value field value if set, zero value otherwise.
func (o *CollectionOfPermissionsWithAllowedValues) GetValue() []Permission {
	if o == nil || IsNil(o.Value) {
		var ret []Permission
		return ret
	}
	return o.Value
}

// GetValueOk returns a tuple with the Value field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *CollectionOfPermissionsWithAllowedValues) GetValueOk() ([]Permission, bool) {
	if o == nil || IsNil(o.Value) {
		return nil, false
	}
	return o.Value, true
}

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

	return false
}

// SetValue gets a reference to the given []Permission and assigns it to the Value field.
func (o *CollectionOfPermissionsWithAllowedValues) SetValue(v []Permission) {
	o.Value = v
}

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

func (o CollectionOfPermissionsWithAllowedValues) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !IsNil(o.LibreGraphPermissionsRolesAllowedValues) {
		toSerialize["@libre.graph.permissions.roles.allowedValues"] = o.LibreGraphPermissionsRolesAllowedValues
	}
	if !IsNil(o.LibreGraphPermissionsActionsAllowedValues) {
		toSerialize["@libre.graph.permissions.actions.allowedValues"] = o.LibreGraphPermissionsActionsAllowedValues
	}
	if !IsNil(o.Value) {
		toSerialize["value"] = o.Value
	}
	return toSerialize, nil
}

type NullableCollectionOfPermissionsWithAllowedValues struct {
	value *CollectionOfPermissionsWithAllowedValues
	isSet bool
}

func (v NullableCollectionOfPermissionsWithAllowedValues) Get() *CollectionOfPermissionsWithAllowedValues {
	return v.value
}

func (v *NullableCollectionOfPermissionsWithAllowedValues) Set(val *CollectionOfPermissionsWithAllowedValues) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableCollectionOfPermissionsWithAllowedValues(val *CollectionOfPermissionsWithAllowedValues) *NullableCollectionOfPermissionsWithAllowedValues {
	return &NullableCollectionOfPermissionsWithAllowedValues{value: val, isSet: true}
}

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

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