/*
1Backend

AI-native microservices platform.

API version: 0.8.2
Contact: sales@singulatron.com
*/

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

package openapi

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

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

// UserSvcContactInput struct for UserSvcContactInput
type UserSvcContactInput struct {
	// Handle is the platform local unique identifier. Ie. while the `id` of a Twitter contact is `twitter.com/thejoe`, the value will be only `thejoe`. For email and phones the `id` and the `value` will be the same. This field mostly exists for display purposes.  Example values: \"joe12\" (1backend username), \"thejoe\" (twitter username), \"joe@joesdomain.com\" (email)
	Handle *string `json:"handle,omitempty"`
	// The unique identifier, which can be a URL.  Example values: \"joe12\" (1backend username), \"twitter.com/thejoe\" (twitter url), \"joe@joesdomain.com\" (email)
	Id string `json:"id"`
	// Platform of the contact (e.g., \"email\", \"phone\", \"twitter\")
	Platform string `json:"platform"`
}

type _UserSvcContactInput UserSvcContactInput

// NewUserSvcContactInput instantiates a new UserSvcContactInput 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 NewUserSvcContactInput(id string, platform string) *UserSvcContactInput {
	this := UserSvcContactInput{}
	this.Id = id
	this.Platform = platform
	return &this
}

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

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

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

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

	return false
}

// SetHandle gets a reference to the given string and assigns it to the Handle field.
func (o *UserSvcContactInput) SetHandle(v string) {
	o.Handle = &v
}

// GetId returns the Id field value
func (o *UserSvcContactInput) 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 *UserSvcContactInput) GetIdOk() (*string, bool) {
	if o == nil {
		return nil, false
	}
	return &o.Id, true
}

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

// GetPlatform returns the Platform field value
func (o *UserSvcContactInput) GetPlatform() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Platform
}

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

// SetPlatform sets field value
func (o *UserSvcContactInput) SetPlatform(v string) {
	o.Platform = v
}

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

func (o UserSvcContactInput) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !IsNil(o.Handle) {
		toSerialize["handle"] = o.Handle
	}
	toSerialize["id"] = o.Id
	toSerialize["platform"] = o.Platform
	return toSerialize, nil
}

func (o *UserSvcContactInput) 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",
		"platform",
	}

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

	varUserSvcContactInput := _UserSvcContactInput{}

	decoder := json.NewDecoder(bytes.NewReader(data))
	decoder.DisallowUnknownFields()
	err = decoder.Decode(&varUserSvcContactInput)

	if err != nil {
		return err
	}

	*o = UserSvcContactInput(varUserSvcContactInput)

	return err
}

type NullableUserSvcContactInput struct {
	value *UserSvcContactInput
	isSet bool
}

func (v NullableUserSvcContactInput) Get() *UserSvcContactInput {
	return v.value
}

func (v *NullableUserSvcContactInput) Set(val *UserSvcContactInput) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableUserSvcContactInput(val *UserSvcContactInput) *NullableUserSvcContactInput {
	return &NullableUserSvcContactInput{value: val, isSet: true}
}

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

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


