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

// MouseScrollRequest struct for MouseScrollRequest
type MouseScrollRequest struct {
	// The X coordinate where to perform the scroll operation
	X float32 `json:"x"`
	// The Y coordinate where to perform the scroll operation
	Y float32 `json:"y"`
	// The scroll direction (up, down)
	Direction string `json:"direction"`
	// The number of scroll units to scroll. Defaults to 1
	Amount *float32 `json:"amount,omitempty"`
	AdditionalProperties map[string]interface{}
}

type _MouseScrollRequest MouseScrollRequest

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

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

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

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

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

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

// GetDirection returns the Direction field value
func (o *MouseScrollRequest) GetDirection() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Direction
}

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

// SetDirection sets field value
func (o *MouseScrollRequest) SetDirection(v string) {
	o.Direction = v
}

// GetAmount returns the Amount field value if set, zero value otherwise.
func (o *MouseScrollRequest) GetAmount() float32 {
	if o == nil || IsNil(o.Amount) {
		var ret float32
		return ret
	}
	return *o.Amount
}

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

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

	return false
}

// SetAmount gets a reference to the given float32 and assigns it to the Amount field.
func (o *MouseScrollRequest) SetAmount(v float32) {
	o.Amount = &v
}

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

func (o MouseScrollRequest) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["x"] = o.X
	toSerialize["y"] = o.Y
	toSerialize["direction"] = o.Direction
	if !IsNil(o.Amount) {
		toSerialize["amount"] = o.Amount
	}

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

	return toSerialize, nil
}

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

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

	varMouseScrollRequest := _MouseScrollRequest{}

	err = json.Unmarshal(data, &varMouseScrollRequest)

	if err != nil {
		return err
	}

	*o = MouseScrollRequest(varMouseScrollRequest)

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

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

	return err
}

type NullableMouseScrollRequest struct {
	value *MouseScrollRequest
	isSet bool
}

func (v NullableMouseScrollRequest) Get() *MouseScrollRequest {
	return v.value
}

func (v *NullableMouseScrollRequest) Set(val *MouseScrollRequest) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableMouseScrollRequest(val *MouseScrollRequest) *NullableMouseScrollRequest {
	return &NullableMouseScrollRequest{value: val, isSet: true}
}

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

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


