/*
Daytona

Daytona AI platform API Docs

API version: 1.0
Contact: support@daytona.com
*/

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

package apiclient

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

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

// BuildInfo struct for BuildInfo
type BuildInfo struct {
	// The Dockerfile content used for the build
	DockerfileContent *string `json:"dockerfileContent,omitempty"`
	// The context hashes used for the build
	ContextHashes []string `json:"contextHashes,omitempty"`
	// The creation timestamp
	CreatedAt time.Time `json:"createdAt"`
	// The last update timestamp
	UpdatedAt time.Time `json:"updatedAt"`
	// The snapshot reference
	SnapshotRef string `json:"snapshotRef"`
	AdditionalProperties map[string]interface{}
}

type _BuildInfo BuildInfo

// NewBuildInfo instantiates a new BuildInfo 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 NewBuildInfo(createdAt time.Time, updatedAt time.Time, snapshotRef string) *BuildInfo {
	this := BuildInfo{}
	this.CreatedAt = createdAt
	this.UpdatedAt = updatedAt
	this.SnapshotRef = snapshotRef
	return &this
}

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

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

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

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

	return false
}

// SetDockerfileContent gets a reference to the given string and assigns it to the DockerfileContent field.
func (o *BuildInfo) SetDockerfileContent(v string) {
	o.DockerfileContent = &v
}

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

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

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

	return false
}

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

// GetCreatedAt returns the CreatedAt field value
func (o *BuildInfo) GetCreatedAt() time.Time {
	if o == nil {
		var ret time.Time
		return ret
	}

	return o.CreatedAt
}

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

// SetCreatedAt sets field value
func (o *BuildInfo) SetCreatedAt(v time.Time) {
	o.CreatedAt = v
}

// GetUpdatedAt returns the UpdatedAt field value
func (o *BuildInfo) GetUpdatedAt() time.Time {
	if o == nil {
		var ret time.Time
		return ret
	}

	return o.UpdatedAt
}

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

// SetUpdatedAt sets field value
func (o *BuildInfo) SetUpdatedAt(v time.Time) {
	o.UpdatedAt = v
}

// GetSnapshotRef returns the SnapshotRef field value
func (o *BuildInfo) GetSnapshotRef() string {
	if o == nil {
		var ret string
		return ret
	}

	return o.SnapshotRef
}

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

// SetSnapshotRef sets field value
func (o *BuildInfo) SetSnapshotRef(v string) {
	o.SnapshotRef = v
}

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

func (o BuildInfo) ToMap() (map[string]interface{}, error) {
	toSerialize := map[string]interface{}{}
	if !IsNil(o.DockerfileContent) {
		toSerialize["dockerfileContent"] = o.DockerfileContent
	}
	if !IsNil(o.ContextHashes) {
		toSerialize["contextHashes"] = o.ContextHashes
	}
	toSerialize["createdAt"] = o.CreatedAt
	toSerialize["updatedAt"] = o.UpdatedAt
	toSerialize["snapshotRef"] = o.SnapshotRef

	for key, value := range o.AdditionalProperties {
		toSerialize[key] = value
	}

	return toSerialize, nil
}

func (o *BuildInfo) 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{
		"createdAt",
		"updatedAt",
		"snapshotRef",
	}

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

	varBuildInfo := _BuildInfo{}

	err = json.Unmarshal(data, &varBuildInfo)

	if err != nil {
		return err
	}

	*o = BuildInfo(varBuildInfo)

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

	if err = json.Unmarshal(data, &additionalProperties); err == nil {
		delete(additionalProperties, "dockerfileContent")
		delete(additionalProperties, "contextHashes")
		delete(additionalProperties, "createdAt")
		delete(additionalProperties, "updatedAt")
		delete(additionalProperties, "snapshotRef")
		o.AdditionalProperties = additionalProperties
	}

	return err
}

type NullableBuildInfo struct {
	value *BuildInfo
	isSet bool
}

func (v NullableBuildInfo) Get() *BuildInfo {
	return v.value
}

func (v *NullableBuildInfo) Set(val *BuildInfo) {
	v.value = val
	v.isSet = true
}

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

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

func NewNullableBuildInfo(val *BuildInfo) *NullableBuildInfo {
	return &NullableBuildInfo{value: val, isSet: true}
}

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

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


