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

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

// MouseClickRequest struct for MouseClickRequest
type MouseClickRequest struct {
	// The X coordinate where to perform the mouse click
	X float32 `json:"x"`
	// The Y coordinate where to perform the mouse click
	Y float32 `json:"y"`
	// The mouse button to click (left, right, middle). Defaults to left
	Button *string `json:"button,omitempty"`
	// Whether to perform a double-click instead of a single click
	Double *bool `json:"double,omitempty"`
	AdditionalProperties map[string]interface{}
}

type _MouseClickRequest MouseClickRequest

// NewMouseClickRequest instantiates a new MouseClickRequest 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 NewMouseClickRequest(x float32, y float32) *MouseClickRequest {
	this := MouseClickRequest{}
	this.X = x
	this.Y = y
	return &this
}

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

// GetX returns the X field value
func (o *MouseClickRequest) GetX() float32 {
	if o == nil {
		var ret float32
		return ret
	}

	return o.X
}

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

// SetX sets field value
func (o *MouseClickRequest) SetX(v float32) {
	o.X = v
}

// GetY returns the Y field value
func (o *MouseClickRequest) GetY() float32 {
	if o == nil {
		var ret float32
		return ret
	}

	return o.Y
}

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

// SetY sets field value
func (o *MouseClickRequest) SetY(v float32) {
	o.Y = v
}

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

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

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

	return false
}

// SetButton gets a reference to the given string and assigns it to the Button field.
func (o *MouseClickRequest) SetButton(v string) {
	o.Button = &v
}

// GetDouble returns the Double field value if set, zero value otherwise.
func (o *MouseClickRequest) GetDouble() bool {
	if o == nil || IsNil(o.Double) {
		var ret bool
		return ret
	}
	return *o.Double
}

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

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

	return false
}

// SetDouble gets a reference to the given bool and assigns it to the Double field.
func (o *MouseClickRequest) SetDouble(v bool) {
	o.Double = &v
}

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

func (o MouseClickRequest) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["x"] = o.X
	toSerialize["y"] = o.Y
	if !IsNil(o.Button) {
		toSerialize["button"] = o.Button
	}
	if !IsNil(o.Double) {
		toSerialize["double"] = o.Double
	}

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

	return toSerialize, nil
}

func (o *MouseClickRequest) 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{
		"x",
		"y",
	}

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

	varMouseClickRequest := _MouseClickRequest{}

	err = json.Unmarshal(data, &varMouseClickRequest)

	if err != nil {
		return err
	}

	*o = MouseClickRequest(varMouseClickRequest)

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

	if err = json.Unmarshal(data, &additionalProperties); err == nil {
		delete(additionalProperties, "x")
		delete(additionalProperties, "y")
		delete(additionalProperties, "button")
		delete(additionalProperties, "double")
		o.AdditionalProperties = additionalProperties
	}

	return err
}

type NullableMouseClickRequest struct {
	value *MouseClickRequest
	isSet bool
}

func (v NullableMouseClickRequest) Get() *MouseClickRequest {
	return v.value
}

func (v *NullableMouseClickRequest) Set(val *MouseClickRequest) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableMouseClickRequest(val *MouseClickRequest) *NullableMouseClickRequest {
	return &NullableMouseClickRequest{value: val, isSet: true}
}

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

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


