/*
Daytona Toolbox API

Daytona Toolbox API

API version: v0.0.0-dev
*/

// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.

package toolbox

import (
	"encoding/json"
	"bytes"
	"fmt"
)

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

// LspPosition struct for LspPosition
type LspPosition struct {
	Character int32 `json:"character"`
	Line int32 `json:"line"`
}

type _LspPosition LspPosition

// NewLspPosition instantiates a new LspPosition 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 NewLspPosition(character int32, line int32) *LspPosition {
	this := LspPosition{}
	this.Character = character
	this.Line = line
	return &this
}

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

// GetCharacter returns the Character field value
func (o *LspPosition) GetCharacter() int32 {
	if o == nil {
		var ret int32
		return ret
	}

	return o.Character
}

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

// SetCharacter sets field value
func (o *LspPosition) SetCharacter(v int32) {
	o.Character = v
}

// GetLine returns the Line field value
func (o *LspPosition) GetLine() int32 {
	if o == nil {
		var ret int32
		return ret
	}

	return o.Line
}

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

// SetLine sets field value
func (o *LspPosition) SetLine(v int32) {
	o.Line = v
}

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

func (o LspPosition) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["character"] = o.Character
	toSerialize["line"] = o.Line
	return toSerialize, nil
}

func (o *LspPosition) 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{
		"character",
		"line",
	}

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

	varLspPosition := _LspPosition{}

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

	if err != nil {
		return err
	}

	*o = LspPosition(varLspPosition)

	return err
}

type NullableLspPosition struct {
	value *LspPosition
	isSet bool
}

func (v NullableLspPosition) Get() *LspPosition {
	return v.value
}

func (v *NullableLspPosition) Set(val *LspPosition) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableLspPosition(val *LspPosition) *NullableLspPosition {
	return &NullableLspPosition{value: val, isSet: true}
}

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

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


