/*
Daytona

Daytona AI platform API Docs

API version: 1.0
Contact: support@daytona.com
*/

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

package apiclient

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

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

// OrganizationInvitation struct for OrganizationInvitation
type OrganizationInvitation struct {
	// Invitation ID
	Id string `json:"id"`
	// Email address of the invitee
	Email string `json:"email"`
	// Email address of the inviter
	InvitedBy string `json:"invitedBy"`
	// Organization ID
	OrganizationId string `json:"organizationId"`
	// Organization name
	OrganizationName string `json:"organizationName"`
	// Expiration date of the invitation
	ExpiresAt time.Time `json:"expiresAt"`
	// Invitation status
	Status string `json:"status"`
	// Member role
	Role string `json:"role"`
	// Assigned roles
	AssignedRoles []OrganizationRole `json:"assignedRoles"`
	// Creation timestamp
	CreatedAt time.Time `json:"createdAt"`
	// Last update timestamp
	UpdatedAt time.Time `json:"updatedAt"`
	AdditionalProperties map[string]interface{}
}

type _OrganizationInvitation OrganizationInvitation

// NewOrganizationInvitation instantiates a new OrganizationInvitation 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 NewOrganizationInvitation(id string, email string, invitedBy string, organizationId string, organizationName string, expiresAt time.Time, status string, role string, assignedRoles []OrganizationRole, createdAt time.Time, updatedAt time.Time) *OrganizationInvitation {
	this := OrganizationInvitation{}
	this.Id = id
	this.Email = email
	this.InvitedBy = invitedBy
	this.OrganizationId = organizationId
	this.OrganizationName = organizationName
	this.ExpiresAt = expiresAt
	this.Status = status
	this.Role = role
	this.AssignedRoles = assignedRoles
	this.CreatedAt = createdAt
	this.UpdatedAt = updatedAt
	return &this
}

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

// GetId returns the Id field value
func (o *OrganizationInvitation) GetId() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Id
}

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

// SetId sets field value
func (o *OrganizationInvitation) SetId(v string) {
	o.Id = v
}

// GetEmail returns the Email field value
func (o *OrganizationInvitation) GetEmail() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Email
}

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

// SetEmail sets field value
func (o *OrganizationInvitation) SetEmail(v string) {
	o.Email = v
}

// GetInvitedBy returns the InvitedBy field value
func (o *OrganizationInvitation) GetInvitedBy() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.InvitedBy
}

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

// SetInvitedBy sets field value
func (o *OrganizationInvitation) SetInvitedBy(v string) {
	o.InvitedBy = v
}

// GetOrganizationId returns the OrganizationId field value
func (o *OrganizationInvitation) GetOrganizationId() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.OrganizationId
}

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

// SetOrganizationId sets field value
func (o *OrganizationInvitation) SetOrganizationId(v string) {
	o.OrganizationId = v
}

// GetOrganizationName returns the OrganizationName field value
func (o *OrganizationInvitation) GetOrganizationName() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.OrganizationName
}

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

// SetOrganizationName sets field value
func (o *OrganizationInvitation) SetOrganizationName(v string) {
	o.OrganizationName = v
}

// GetExpiresAt returns the ExpiresAt field value
func (o *OrganizationInvitation) GetExpiresAt() time.Time {
	if o == nil {
		var ret time.Time
		return ret
	}

	return o.ExpiresAt
}

// GetExpiresAtOk returns a tuple with the ExpiresAt field value
// and a boolean to check if the value has been set.
func (o *OrganizationInvitation) GetExpiresAtOk() (*time.Time, bool) {
	if o == nil {
		return nil, false
	}
	return &o.ExpiresAt, true
}

// SetExpiresAt sets field value
func (o *OrganizationInvitation) SetExpiresAt(v time.Time) {
	o.ExpiresAt = v
}

// GetStatus returns the Status field value
func (o *OrganizationInvitation) GetStatus() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Status
}

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

// SetStatus sets field value
func (o *OrganizationInvitation) SetStatus(v string) {
	o.Status = v
}

// GetRole returns the Role field value
func (o *OrganizationInvitation) GetRole() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Role
}

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

// SetRole sets field value
func (o *OrganizationInvitation) SetRole(v string) {
	o.Role = v
}

// GetAssignedRoles returns the AssignedRoles field value
func (o *OrganizationInvitation) GetAssignedRoles() []OrganizationRole {
	if o == nil {
		var ret []OrganizationRole
		return ret
	}

	return o.AssignedRoles
}

// GetAssignedRolesOk returns a tuple with the AssignedRoles field value
// and a boolean to check if the value has been set.
func (o *OrganizationInvitation) GetAssignedRolesOk() ([]OrganizationRole, bool) {
	if o == nil {
		return nil, false
	}
	return o.AssignedRoles, true
}

// SetAssignedRoles sets field value
func (o *OrganizationInvitation) SetAssignedRoles(v []OrganizationRole) {
	o.AssignedRoles = v
}

// GetCreatedAt returns the CreatedAt field value
func (o *OrganizationInvitation) GetCreatedAt() time.Time {
	if o == nil {
		var ret time.Time
		return ret
	}

	return o.CreatedAt
}

// GetCreatedAtOk returns a tuple with the CreatedAt field value
// and a boolean to check if the value has been set.
func (o *OrganizationInvitation) GetCreatedAtOk() (*time.Time, bool) {
	if o == nil {
		return nil, false
	}
	return &o.CreatedAt, true
}

// SetCreatedAt sets field value
func (o *OrganizationInvitation) SetCreatedAt(v time.Time) {
	o.CreatedAt = v
}

// GetUpdatedAt returns the UpdatedAt field value
func (o *OrganizationInvitation) GetUpdatedAt() time.Time {
	if o == nil {
		var ret time.Time
		return ret
	}

	return o.UpdatedAt
}

// GetUpdatedAtOk returns a tuple with the UpdatedAt field value
// and a boolean to check if the value has been set.
func (o *OrganizationInvitation) GetUpdatedAtOk() (*time.Time, bool) {
	if o == nil {
		return nil, false
	}
	return &o.UpdatedAt, true
}

// SetUpdatedAt sets field value
func (o *OrganizationInvitation) SetUpdatedAt(v time.Time) {
	o.UpdatedAt = v
}

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

func (o OrganizationInvitation) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["id"] = o.Id
	toSerialize["email"] = o.Email
	toSerialize["invitedBy"] = o.InvitedBy
	toSerialize["organizationId"] = o.OrganizationId
	toSerialize["organizationName"] = o.OrganizationName
	toSerialize["expiresAt"] = o.ExpiresAt
	toSerialize["status"] = o.Status
	toSerialize["role"] = o.Role
	toSerialize["assignedRoles"] = o.AssignedRoles
	toSerialize["createdAt"] = o.CreatedAt
	toSerialize["updatedAt"] = o.UpdatedAt

	for key, value := range o.AdditionalProperties {
		toSerialize[key] = value
	}

	return toSerialize, nil
}

func (o *OrganizationInvitation) 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{
		"id",
		"email",
		"invitedBy",
		"organizationId",
		"organizationName",
		"expiresAt",
		"status",
		"role",
		"assignedRoles",
		"createdAt",
		"updatedAt",
	}

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

	varOrganizationInvitation := _OrganizationInvitation{}

	err = json.Unmarshal(data, &varOrganizationInvitation)

	if err != nil {
		return err
	}

	*o = OrganizationInvitation(varOrganizationInvitation)

	additionalProperties := make(map[string]interface{})

	if err = json.Unmarshal(data, &additionalProperties); err == nil {
		delete(additionalProperties, "id")
		delete(additionalProperties, "email")
		delete(additionalProperties, "invitedBy")
		delete(additionalProperties, "organizationId")
		delete(additionalProperties, "organizationName")
		delete(additionalProperties, "expiresAt")
		delete(additionalProperties, "status")
		delete(additionalProperties, "role")
		delete(additionalProperties, "assignedRoles")
		delete(additionalProperties, "createdAt")
		delete(additionalProperties, "updatedAt")
		o.AdditionalProperties = additionalProperties
	}

	return err
}

type NullableOrganizationInvitation struct {
	value *OrganizationInvitation
	isSet bool
}

func (v NullableOrganizationInvitation) Get() *OrganizationInvitation {
	return v.value
}

func (v *NullableOrganizationInvitation) Set(val *OrganizationInvitation) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableOrganizationInvitation(val *OrganizationInvitation) *NullableOrganizationInvitation {
	return &NullableOrganizationInvitation{value: val, isSet: true}
}

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

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


