// Code generated by Fern. DO NOT EDIT.

package api

import (
	json "encoding/json"
	fmt "fmt"
	big "math/big"
	internal "pentagi/pkg/observability/langfuse/api/internal"
)

var (
	healthResponseFieldVersion = big.NewInt(1 << 0)
	healthResponseFieldStatus  = big.NewInt(1 << 1)
)

type HealthResponse struct {
	// Langfuse server version
	Version string `json:"version" url:"version"`
	Status  string `json:"status" url:"status"`

	// Private bitmask of fields set to an explicit value and therefore not to be omitted
	explicitFields *big.Int `json:"-" url:"-"`

	extraProperties map[string]interface{}
	rawJSON         json.RawMessage
}

func (h *HealthResponse) GetVersion() string {
	if h == nil {
		return ""
	}
	return h.Version
}

func (h *HealthResponse) GetStatus() string {
	if h == nil {
		return ""
	}
	return h.Status
}

func (h *HealthResponse) GetExtraProperties() map[string]interface{} {
	return h.extraProperties
}

func (h *HealthResponse) require(field *big.Int) {
	if h.explicitFields == nil {
		h.explicitFields = big.NewInt(0)
	}
	h.explicitFields.Or(h.explicitFields, field)
}

// SetVersion sets the Version field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (h *HealthResponse) SetVersion(version string) {
	h.Version = version
	h.require(healthResponseFieldVersion)
}

// SetStatus sets the Status field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (h *HealthResponse) SetStatus(status string) {
	h.Status = status
	h.require(healthResponseFieldStatus)
}

func (h *HealthResponse) UnmarshalJSON(data []byte) error {
	type unmarshaler HealthResponse
	var value unmarshaler
	if err := json.Unmarshal(data, &value); err != nil {
		return err
	}
	*h = HealthResponse(value)
	extraProperties, err := internal.ExtractExtraProperties(data, *h)
	if err != nil {
		return err
	}
	h.extraProperties = extraProperties
	h.rawJSON = json.RawMessage(data)
	return nil
}

func (h *HealthResponse) MarshalJSON() ([]byte, error) {
	type embed HealthResponse
	var marshaler = struct {
		embed
	}{
		embed: embed(*h),
	}
	explicitMarshaler := internal.HandleExplicitFields(marshaler, h.explicitFields)
	return json.Marshal(explicitMarshaler)
}

func (h *HealthResponse) String() string {
	if len(h.rawJSON) > 0 {
		if value, err := internal.StringifyJSON(h.rawJSON); err == nil {
			return value
		}
	}
	if value, err := internal.StringifyJSON(h); err == nil {
		return value
	}
	return fmt.Sprintf("%#v", h)
}
