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

// LspCompletionParams struct for LspCompletionParams
type LspCompletionParams struct {
	Context *CompletionContext `json:"context,omitempty"`
	LanguageId string `json:"languageId"`
	PathToProject string `json:"pathToProject"`
	Position LspPosition `json:"position"`
	Uri string `json:"uri"`
}

type _LspCompletionParams LspCompletionParams

// NewLspCompletionParams instantiates a new LspCompletionParams 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 NewLspCompletionParams(languageId string, pathToProject string, position LspPosition, uri string) *LspCompletionParams {
	this := LspCompletionParams{}
	this.LanguageId = languageId
	this.PathToProject = pathToProject
	this.Position = position
	this.Uri = uri
	return &this
}

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

// GetContext returns the Context field value if set, zero value otherwise.
func (o *LspCompletionParams) GetContext() CompletionContext {
	if o == nil || IsNil(o.Context) {
		var ret CompletionContext
		return ret
	}
	return *o.Context
}

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

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

	return false
}

// SetContext gets a reference to the given CompletionContext and assigns it to the Context field.
func (o *LspCompletionParams) SetContext(v CompletionContext) {
	o.Context = &v
}

// GetLanguageId returns the LanguageId field value
func (o *LspCompletionParams) GetLanguageId() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.LanguageId
}

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

// SetLanguageId sets field value
func (o *LspCompletionParams) SetLanguageId(v string) {
	o.LanguageId = v
}

// GetPathToProject returns the PathToProject field value
func (o *LspCompletionParams) GetPathToProject() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.PathToProject
}

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

// SetPathToProject sets field value
func (o *LspCompletionParams) SetPathToProject(v string) {
	o.PathToProject = v
}

// GetPosition returns the Position field value
func (o *LspCompletionParams) GetPosition() LspPosition {
	if o == nil {
		var ret LspPosition
		return ret
	}

	return o.Position
}

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

// SetPosition sets field value
func (o *LspCompletionParams) SetPosition(v LspPosition) {
	o.Position = v
}

// GetUri returns the Uri field value
func (o *LspCompletionParams) GetUri() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Uri
}

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

// SetUri sets field value
func (o *LspCompletionParams) SetUri(v string) {
	o.Uri = v
}

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

func (o LspCompletionParams) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !IsNil(o.Context) {
		toSerialize["context"] = o.Context
	}
	toSerialize["languageId"] = o.LanguageId
	toSerialize["pathToProject"] = o.PathToProject
	toSerialize["position"] = o.Position
	toSerialize["uri"] = o.Uri
	return toSerialize, nil
}

func (o *LspCompletionParams) 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{
		"languageId",
		"pathToProject",
		"position",
		"uri",
	}

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

	varLspCompletionParams := _LspCompletionParams{}

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

	if err != nil {
		return err
	}

	*o = LspCompletionParams(varLspCompletionParams)

	return err
}

type NullableLspCompletionParams struct {
	value *LspCompletionParams
	isSet bool
}

func (v NullableLspCompletionParams) Get() *LspCompletionParams {
	return v.value
}

func (v *NullableLspCompletionParams) Set(val *LspCompletionParams) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableLspCompletionParams(val *LspCompletionParams) *NullableLspCompletionParams {
	return &NullableLspCompletionParams{value: val, isSet: true}
}

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

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


