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

// GroundTruthSource struct for GroundTruthSource
type GroundTruthSource struct {
	TableUrn             string `json:"table_urn"`
	EventTimestampColumn string `json:"event_timestamp_column"`
	SourceProject        string `json:"source_project"`
}

type _GroundTruthSource GroundTruthSource

// NewGroundTruthSource instantiates a new GroundTruthSource 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 NewGroundTruthSource(tableUrn string, eventTimestampColumn string, sourceProject string) *GroundTruthSource {
	this := GroundTruthSource{}
	this.TableUrn = tableUrn
	this.EventTimestampColumn = eventTimestampColumn
	this.SourceProject = sourceProject
	return &this
}

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

// GetTableUrn returns the TableUrn field value
func (o *GroundTruthSource) GetTableUrn() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.TableUrn
}

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

// SetTableUrn sets field value
func (o *GroundTruthSource) SetTableUrn(v string) {
	o.TableUrn = v
}

// GetEventTimestampColumn returns the EventTimestampColumn field value
func (o *GroundTruthSource) GetEventTimestampColumn() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.EventTimestampColumn
}

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

// SetEventTimestampColumn sets field value
func (o *GroundTruthSource) SetEventTimestampColumn(v string) {
	o.EventTimestampColumn = v
}

// GetSourceProject returns the SourceProject field value
func (o *GroundTruthSource) GetSourceProject() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.SourceProject
}

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

// SetSourceProject sets field value
func (o *GroundTruthSource) SetSourceProject(v string) {
	o.SourceProject = v
}

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

func (o GroundTruthSource) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["table_urn"] = o.TableUrn
	toSerialize["event_timestamp_column"] = o.EventTimestampColumn
	toSerialize["source_project"] = o.SourceProject
	return toSerialize, nil
}

func (o *GroundTruthSource) 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{
		"table_urn",
		"event_timestamp_column",
		"source_project",
	}

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

	varGroundTruthSource := _GroundTruthSource{}

	err = json.Unmarshal(bytes, &varGroundTruthSource)

	if err != nil {
		return err
	}

	*o = GroundTruthSource(varGroundTruthSource)

	return err
}

type NullableGroundTruthSource struct {
	value *GroundTruthSource
	isSet bool
}

func (v NullableGroundTruthSource) Get() *GroundTruthSource {
	return v.value
}

func (v *NullableGroundTruthSource) Set(val *GroundTruthSource) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableGroundTruthSource(val *GroundTruthSource) *NullableGroundTruthSource {
	return &NullableGroundTruthSource{value: val, isSet: true}
}

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

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