/*
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"
	"time"
)

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

// Project struct for Project
type Project struct {
	Id                int32      `json:"id"`
	Name              string     `json:"name"`
	MlflowTrackingUrl *string    `json:"mlflow_tracking_url,omitempty"`
	Administrators    []string   `json:"administrators,omitempty"`
	Readers           []string   `json:"readers,omitempty"`
	Team              *string    `json:"team,omitempty"`
	Stream            *string    `json:"stream,omitempty"`
	Labels            []Label    `json:"labels,omitempty"`
	CreatedAt         *time.Time `json:"created_at,omitempty"`
	UpdatedAt         *time.Time `json:"updated_at,omitempty"`
}

type _Project Project

// NewProject instantiates a new Project 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 NewProject(id int32, name string) *Project {
	this := Project{}
	this.Id = id
	this.Name = name
	return &this
}

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

// GetId returns the Id field value
func (o *Project) GetId() int32 {
	if o == nil {
		var ret int32
		return ret
	}

	return o.Id
}

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

// SetId sets field value
func (o *Project) SetId(v int32) {
	o.Id = v
}

// GetName returns the Name field value
func (o *Project) GetName() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.Name
}

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

// SetName sets field value
func (o *Project) SetName(v string) {
	o.Name = v
}

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

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

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

	return false
}

// SetMlflowTrackingUrl gets a reference to the given string and assigns it to the MlflowTrackingUrl field.
func (o *Project) SetMlflowTrackingUrl(v string) {
	o.MlflowTrackingUrl = &v
}

// GetAdministrators returns the Administrators field value if set, zero value otherwise.
func (o *Project) GetAdministrators() []string {
	if o == nil || IsNil(o.Administrators) {
		var ret []string
		return ret
	}
	return o.Administrators
}

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

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

	return false
}

// SetAdministrators gets a reference to the given []string and assigns it to the Administrators field.
func (o *Project) SetAdministrators(v []string) {
	o.Administrators = v
}

// GetReaders returns the Readers field value if set, zero value otherwise.
func (o *Project) GetReaders() []string {
	if o == nil || IsNil(o.Readers) {
		var ret []string
		return ret
	}
	return o.Readers
}

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

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

	return false
}

// SetReaders gets a reference to the given []string and assigns it to the Readers field.
func (o *Project) SetReaders(v []string) {
	o.Readers = v
}

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

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

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

	return false
}

// SetTeam gets a reference to the given string and assigns it to the Team field.
func (o *Project) SetTeam(v string) {
	o.Team = &v
}

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

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

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

	return false
}

// SetStream gets a reference to the given string and assigns it to the Stream field.
func (o *Project) SetStream(v string) {
	o.Stream = &v
}

// GetLabels returns the Labels field value if set, zero value otherwise.
func (o *Project) GetLabels() []Label {
	if o == nil || IsNil(o.Labels) {
		var ret []Label
		return ret
	}
	return o.Labels
}

// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Project) GetLabelsOk() ([]Label, bool) {
	if o == nil || IsNil(o.Labels) {
		return nil, false
	}
	return o.Labels, true
}

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

	return false
}

// SetLabels gets a reference to the given []Label and assigns it to the Labels field.
func (o *Project) SetLabels(v []Label) {
	o.Labels = v
}

// GetCreatedAt returns the CreatedAt field value if set, zero value otherwise.
func (o *Project) GetCreatedAt() time.Time {
	if o == nil || IsNil(o.CreatedAt) {
		var ret time.Time
		return ret
	}
	return *o.CreatedAt
}

// GetCreatedAtOk returns a tuple with the CreatedAt field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Project) GetCreatedAtOk() (*time.Time, bool) {
	if o == nil || IsNil(o.CreatedAt) {
		return nil, false
	}
	return o.CreatedAt, true
}

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

	return false
}

// SetCreatedAt gets a reference to the given time.Time and assigns it to the CreatedAt field.
func (o *Project) SetCreatedAt(v time.Time) {
	o.CreatedAt = &v
}

// GetUpdatedAt returns the UpdatedAt field value if set, zero value otherwise.
func (o *Project) GetUpdatedAt() time.Time {
	if o == nil || IsNil(o.UpdatedAt) {
		var ret time.Time
		return ret
	}
	return *o.UpdatedAt
}

// GetUpdatedAtOk returns a tuple with the UpdatedAt field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *Project) GetUpdatedAtOk() (*time.Time, bool) {
	if o == nil || IsNil(o.UpdatedAt) {
		return nil, false
	}
	return o.UpdatedAt, true
}

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

	return false
}

// SetUpdatedAt gets a reference to the given time.Time and assigns it to the UpdatedAt field.
func (o *Project) SetUpdatedAt(v time.Time) {
	o.UpdatedAt = &v
}

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

func (o Project) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	toSerialize["id"] = o.Id
	toSerialize["name"] = o.Name
	if !IsNil(o.MlflowTrackingUrl) {
		toSerialize["mlflow_tracking_url"] = o.MlflowTrackingUrl
	}
	if !IsNil(o.Administrators) {
		toSerialize["administrators"] = o.Administrators
	}
	if !IsNil(o.Readers) {
		toSerialize["readers"] = o.Readers
	}
	if !IsNil(o.Team) {
		toSerialize["team"] = o.Team
	}
	if !IsNil(o.Stream) {
		toSerialize["stream"] = o.Stream
	}
	if !IsNil(o.Labels) {
		toSerialize["labels"] = o.Labels
	}
	if !IsNil(o.CreatedAt) {
		toSerialize["created_at"] = o.CreatedAt
	}
	if !IsNil(o.UpdatedAt) {
		toSerialize["updated_at"] = o.UpdatedAt
	}
	return toSerialize, nil
}

func (o *Project) 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{
		"id",
		"name",
	}

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

	varProject := _Project{}

	err = json.Unmarshal(bytes, &varProject)

	if err != nil {
		return err
	}

	*o = Project(varProject)

	return err
}

type NullableProject struct {
	value *Project
	isSet bool
}

func (v NullableProject) Get() *Project {
	return v.value
}

func (v *NullableProject) Set(val *Project) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableProject(val *Project) *NullableProject {
	return &NullableProject{value: val, isSet: true}
}

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

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