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

// MouseDragRequest struct for MouseDragRequest
type MouseDragRequest struct {
	// The starting X coordinate for the drag operation
	StartX float32 `json:"startX"`
	// The starting Y coordinate for the drag operation
	StartY float32 `json:"startY"`
	// The ending X coordinate for the drag operation
	EndX float32 `json:"endX"`
	// The ending Y coordinate for the drag operation
	EndY float32 `json:"endY"`
	// The mouse button to use for dragging (left, right, middle). Defaults to left
	Button *string `json:"button,omitempty"`
	AdditionalProperties map[string]interface{}
}

type _MouseDragRequest MouseDragRequest

// NewMouseDragRequest instantiates a new MouseDragRequest 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 NewMouseDragRequest(startX float32, startY float32, endX float32, endY float32) *MouseDragRequest {
	this := MouseDragRequest{}
	this.StartX = startX
	this.StartY = startY
	this.EndX = endX
	this.EndY = endY
	return &this
}

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

// GetStartX returns the StartX field value
func (o *MouseDragRequest) GetStartX() float32 {
	if o == nil {
		var ret float32
		return ret
	}

	return o.StartX
}

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

// SetStartX sets field value
func (o *MouseDragRequest) SetStartX(v float32) {
	o.StartX = v
}

// GetStartY returns the StartY field value
func (o *MouseDragRequest) GetStartY() float32 {
	if o == nil {
		var ret float32
		return ret
	}

	return o.StartY
}

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

// SetStartY sets field value
func (o *MouseDragRequest) SetStartY(v float32) {
	o.StartY = v
}

// GetEndX returns the EndX field value
func (o *MouseDragRequest) GetEndX() float32 {
	if o == nil {
		var ret float32
		return ret
	}

	return o.EndX
}

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

// SetEndX sets field value
func (o *MouseDragRequest) SetEndX(v float32) {
	o.EndX = v
}

// GetEndY returns the EndY field value
func (o *MouseDragRequest) GetEndY() float32 {
	if o == nil {
		var ret float32
		return ret
	}

	return o.EndY
}

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

// SetEndY sets field value
func (o *MouseDragRequest) SetEndY(v float32) {
	o.EndY = v
}

// GetButton returns the Button field value if set, zero value otherwise.
func (o *MouseDragRequest) 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 *MouseDragRequest) 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 *MouseDragRequest) 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 *MouseDragRequest) SetButton(v string) {
	o.Button = &v
}

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

func (o MouseDragRequest) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["startX"] = o.StartX
	toSerialize["startY"] = o.StartY
	toSerialize["endX"] = o.EndX
	toSerialize["endY"] = o.EndY
	if !IsNil(o.Button) {
		toSerialize["button"] = o.Button
	}

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

	return toSerialize, nil
}

func (o *MouseDragRequest) 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{
		"startX",
		"startY",
		"endX",
		"endY",
	}

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

	varMouseDragRequest := _MouseDragRequest{}

	err = json.Unmarshal(data, &varMouseDragRequest)

	if err != nil {
		return err
	}

	*o = MouseDragRequest(varMouseDragRequest)

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

	if err = json.Unmarshal(data, &additionalProperties); err == nil {
		delete(additionalProperties, "startX")
		delete(additionalProperties, "startY")
		delete(additionalProperties, "endX")
		delete(additionalProperties, "endY")
		delete(additionalProperties, "button")
		o.AdditionalProperties = additionalProperties
	}

	return err
}

type NullableMouseDragRequest struct {
	value *MouseDragRequest
	isSet bool
}

func (v NullableMouseDragRequest) Get() *MouseDragRequest {
	return v.value
}

func (v *NullableMouseDragRequest) Set(val *MouseDragRequest) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableMouseDragRequest(val *MouseDragRequest) *NullableMouseDragRequest {
	return &NullableMouseDragRequest{value: val, isSet: true}
}

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

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


