/*
Merlin

API Guide for accessing Merlin's model management, deployment, and serving functionalities

API version: 0.14.0
*/

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

package client

import (
	"encoding/json"
	"fmt"
)

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

// RankingOutput struct for RankingOutput
type RankingOutput struct {
	RankScoreColumn      string                     `json:"rank_score_column"`
	RelevanceScoreColumn *string                    `json:"relevance_score_column,omitempty"`
	OutputClass          ModelPredictionOutputClass `json:"output_class"`
}

type _RankingOutput RankingOutput

// NewRankingOutput instantiates a new RankingOutput 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 NewRankingOutput(rankScoreColumn string, outputClass ModelPredictionOutputClass) *RankingOutput {
	this := RankingOutput{}
	this.RankScoreColumn = rankScoreColumn
	this.OutputClass = outputClass
	return &this
}

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

// GetRankScoreColumn returns the RankScoreColumn field value
func (o *RankingOutput) GetRankScoreColumn() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.RankScoreColumn
}

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

// SetRankScoreColumn sets field value
func (o *RankingOutput) SetRankScoreColumn(v string) {
	o.RankScoreColumn = v
}

// GetRelevanceScoreColumn returns the RelevanceScoreColumn field value if set, zero value otherwise.
func (o *RankingOutput) GetRelevanceScoreColumn() string {
	if o == nil || IsNil(o.RelevanceScoreColumn) {
		var ret string
		return ret
	}
	return *o.RelevanceScoreColumn
}

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

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

	return false
}

// SetRelevanceScoreColumn gets a reference to the given string and assigns it to the RelevanceScoreColumn field.
func (o *RankingOutput) SetRelevanceScoreColumn(v string) {
	o.RelevanceScoreColumn = &v
}

// GetOutputClass returns the OutputClass field value
func (o *RankingOutput) GetOutputClass() ModelPredictionOutputClass {
	if o == nil {
		var ret ModelPredictionOutputClass
		return ret
	}

	return o.OutputClass
}

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

// SetOutputClass sets field value
func (o *RankingOutput) SetOutputClass(v ModelPredictionOutputClass) {
	o.OutputClass = v
}

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

func (o RankingOutput) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["rank_score_column"] = o.RankScoreColumn
	if !IsNil(o.RelevanceScoreColumn) {
		toSerialize["relevance_score_column"] = o.RelevanceScoreColumn
	}
	toSerialize["output_class"] = o.OutputClass
	return toSerialize, nil
}

func (o *RankingOutput) UnmarshalJSON(bytes []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{
		"rank_score_column",
		"output_class",
	}

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

	err = json.Unmarshal(bytes, &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)
		}
	}

	varRankingOutput := _RankingOutput{}

	err = json.Unmarshal(bytes, &varRankingOutput)

	if err != nil {
		return err
	}

	*o = RankingOutput(varRankingOutput)

	return err
}

type NullableRankingOutput struct {
	value *RankingOutput
	isSet bool
}

func (v NullableRankingOutput) Get() *RankingOutput {
	return v.value
}

func (v *NullableRankingOutput) Set(val *RankingOutput) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableRankingOutput(val *RankingOutput) *NullableRankingOutput {
	return &NullableRankingOutput{value: val, isSet: true}
}

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

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