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

// MouseDragResponse struct for MouseDragResponse
type MouseDragResponse struct {
	// The actual X coordinate where the drag ended
	X float32 `json:"x"`
	// The actual Y coordinate where the drag ended
	Y float32 `json:"y"`
	AdditionalProperties map[string]interface{}
}

type _MouseDragResponse MouseDragResponse

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

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

// GetX returns the X field value
func (o *MouseDragResponse) 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 *MouseDragResponse) GetXOk() (*float32, bool) {
	if o == nil {
		return nil, false
	}
	return &o.X, true
}

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

// GetY returns the Y field value
func (o *MouseDragResponse) 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 *MouseDragResponse) GetYOk() (*float32, bool) {
	if o == nil {
		return nil, false
	}
	return &o.Y, true
}

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

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

func (o MouseDragResponse) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["x"] = o.X
	toSerialize["y"] = o.Y

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

	return toSerialize, nil
}

func (o *MouseDragResponse) 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)
		}
	}

	varMouseDragResponse := _MouseDragResponse{}

	err = json.Unmarshal(data, &varMouseDragResponse)

	if err != nil {
		return err
	}

	*o = MouseDragResponse(varMouseDragResponse)

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

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

	return err
}

type NullableMouseDragResponse struct {
	value *MouseDragResponse
	isSet bool
}

func (v NullableMouseDragResponse) Get() *MouseDragResponse {
	return v.value
}

func (v *NullableMouseDragResponse) Set(val *MouseDragResponse) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableMouseDragResponse(val *MouseDragResponse) *NullableMouseDragResponse {
	return &NullableMouseDragResponse{value: val, isSet: true}
}

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

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


