/*
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 Shared type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &Shared{}

// Shared struct for Shared
type Shared struct {
	Owner *IdentitySet `json:"owner,omitempty"`
	// Indicates the scope of how the item is shared: anonymous, organization, or users. Read-only.
	Scope    *string      `json:"scope,omitempty"`
	SharedBy *IdentitySet `json:"sharedBy,omitempty"`
	// The UTC date and time when the item was shared. Read-only.
	SharedDateTime *time.Time `json:"sharedDateTime,omitempty"`
}

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

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

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

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

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

	return false
}

// SetOwner gets a reference to the given IdentitySet and assigns it to the Owner field.
func (o *Shared) SetOwner(v IdentitySet) {
	o.Owner = &v
}

// GetScope returns the Scope field value if set, zero value otherwise.
func (o *Shared) GetScope() string {
	if o == nil || IsNil(o.Scope) {
		var ret string
		return ret
	}
	return *o.Scope
}

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

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

	return false
}

// SetScope gets a reference to the given string and assigns it to the Scope field.
func (o *Shared) SetScope(v string) {
	o.Scope = &v
}

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

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

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

	return false
}

// SetSharedBy gets a reference to the given IdentitySet and assigns it to the SharedBy field.
func (o *Shared) SetSharedBy(v IdentitySet) {
	o.SharedBy = &v
}

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

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

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

	return false
}

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

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

func (o Shared) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !IsNil(o.Owner) {
		toSerialize["owner"] = o.Owner
	}
	if !IsNil(o.Scope) {
		toSerialize["scope"] = o.Scope
	}
	if !IsNil(o.SharedBy) {
		toSerialize["sharedBy"] = o.SharedBy
	}
	if !IsNil(o.SharedDateTime) {
		toSerialize["sharedDateTime"] = o.SharedDateTime
	}
	return toSerialize, nil
}

type NullableShared struct {
	value *Shared
	isSet bool
}

func (v NullableShared) Get() *Shared {
	return v.value
}

func (v *NullableShared) Set(val *Shared) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableShared(val *Shared) *NullableShared {
	return &NullableShared{value: val, isSet: true}
}

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

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