/*
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"
	"time"
)

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

// Trash Metadata for trashed drive Items
type Trash struct {
	TrashedBy *IdentitySet `json:"trashedBy,omitempty"`
	// The UTC date and time the folder was marked as trashed.
	TrashedDateTime *time.Time `json:"trashedDateTime,omitempty" validate:"regexp=^[0-9]{4,}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])[Tt]([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]{1,12})?([Zz]|[+-][0-9][0-9]:[0-9][0-9])$"`
}

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

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

// GetTrashedBy returns the TrashedBy field value if set, zero value otherwise.
func (o *Trash) GetTrashedBy() IdentitySet {
	if o == nil || IsNil(o.TrashedBy) {
		var ret IdentitySet
		return ret
	}
	return *o.TrashedBy
}

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

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

	return false
}

// SetTrashedBy gets a reference to the given IdentitySet and assigns it to the TrashedBy field.
func (o *Trash) SetTrashedBy(v IdentitySet) {
	o.TrashedBy = &v
}

// GetTrashedDateTime returns the TrashedDateTime field value if set, zero value otherwise.
func (o *Trash) GetTrashedDateTime() time.Time {
	if o == nil || IsNil(o.TrashedDateTime) {
		var ret time.Time
		return ret
	}
	return *o.TrashedDateTime
}

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

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

	return false
}

// SetTrashedDateTime gets a reference to the given time.Time and assigns it to the TrashedDateTime field.
func (o *Trash) SetTrashedDateTime(v time.Time) {
	o.TrashedDateTime = &v
}

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

func (o Trash) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !IsNil(o.TrashedBy) {
		toSerialize["trashedBy"] = o.TrashedBy
	}
	if !IsNil(o.TrashedDateTime) {
		toSerialize["trashedDateTime"] = o.TrashedDateTime
	}
	return toSerialize, nil
}

type NullableTrash struct {
	value *Trash
	isSet bool
}

func (v NullableTrash) Get() *Trash {
	return v.value
}

func (v *NullableTrash) Set(val *Trash) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableTrash(val *Trash) *NullableTrash {
	return &NullableTrash{value: val, isSet: true}
}

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

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