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

// UserSvcRegisterRequest struct for UserSvcRegisterRequest
type UserSvcRegisterRequest struct {
	AppHost string `json:"appHost"`
	Contact *UserSvcContactInput `json:"contact,omitempty"`
	Device *string `json:"device,omitempty"`
	Name *string `json:"name,omitempty"`
	// Password of the user.
	Password *string `json:"password,omitempty"`
	// Slug is a URL-friendly unique (inside the 1Backend platform) identifier for the `user`. Required due to its central role in the platform. If your project has no use for a slug, just derive it from the email or similar.
	Slug string `json:"slug"`
}

type _UserSvcRegisterRequest UserSvcRegisterRequest

// NewUserSvcRegisterRequest instantiates a new UserSvcRegisterRequest 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 NewUserSvcRegisterRequest(appHost string, slug string) *UserSvcRegisterRequest {
	this := UserSvcRegisterRequest{}
	this.AppHost = appHost
	this.Slug = slug
	return &this
}

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

// GetAppHost returns the AppHost field value
func (o *UserSvcRegisterRequest) GetAppHost() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.AppHost
}

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

// SetAppHost sets field value
func (o *UserSvcRegisterRequest) SetAppHost(v string) {
	o.AppHost = v
}

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

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

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

	return false
}

// SetContact gets a reference to the given UserSvcContactInput and assigns it to the Contact field.
func (o *UserSvcRegisterRequest) SetContact(v UserSvcContactInput) {
	o.Contact = &v
}

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

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

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

	return false
}

// SetDevice gets a reference to the given string and assigns it to the Device field.
func (o *UserSvcRegisterRequest) SetDevice(v string) {
	o.Device = &v
}

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

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

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

	return false
}

// SetName gets a reference to the given string and assigns it to the Name field.
func (o *UserSvcRegisterRequest) SetName(v string) {
	o.Name = &v
}

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

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

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

	return false
}

// SetPassword gets a reference to the given string and assigns it to the Password field.
func (o *UserSvcRegisterRequest) SetPassword(v string) {
	o.Password = &v
}

// GetSlug returns the Slug field value
func (o *UserSvcRegisterRequest) GetSlug() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Slug
}

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

// SetSlug sets field value
func (o *UserSvcRegisterRequest) SetSlug(v string) {
	o.Slug = v
}

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

func (o UserSvcRegisterRequest) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["appHost"] = o.AppHost
	if !IsNil(o.Contact) {
		toSerialize["contact"] = o.Contact
	}
	if !IsNil(o.Device) {
		toSerialize["device"] = o.Device
	}
	if !IsNil(o.Name) {
		toSerialize["name"] = o.Name
	}
	if !IsNil(o.Password) {
		toSerialize["password"] = o.Password
	}
	toSerialize["slug"] = o.Slug
	return toSerialize, nil
}

func (o *UserSvcRegisterRequest) 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{
		"appHost",
		"slug",
	}

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

	varUserSvcRegisterRequest := _UserSvcRegisterRequest{}

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

	if err != nil {
		return err
	}

	*o = UserSvcRegisterRequest(varUserSvcRegisterRequest)

	return err
}

type NullableUserSvcRegisterRequest struct {
	value *UserSvcRegisterRequest
	isSet bool
}

func (v NullableUserSvcRegisterRequest) Get() *UserSvcRegisterRequest {
	return v.value
}

func (v *NullableUserSvcRegisterRequest) Set(val *UserSvcRegisterRequest) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableUserSvcRegisterRequest(val *UserSvcRegisterRequest) *NullableUserSvcRegisterRequest {
	return &NullableUserSvcRegisterRequest{value: val, isSet: true}
}

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

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


