// 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 (
	createScoreRequestFieldID            = big.NewInt(1 << 0)
	createScoreRequestFieldTraceID       = big.NewInt(1 << 1)
	createScoreRequestFieldSessionID     = big.NewInt(1 << 2)
	createScoreRequestFieldObservationID = big.NewInt(1 << 3)
	createScoreRequestFieldDatasetRunID  = big.NewInt(1 << 4)
	createScoreRequestFieldName          = big.NewInt(1 << 5)
	createScoreRequestFieldValue         = big.NewInt(1 << 6)
	createScoreRequestFieldComment       = big.NewInt(1 << 7)
	createScoreRequestFieldMetadata      = big.NewInt(1 << 8)
	createScoreRequestFieldEnvironment   = big.NewInt(1 << 9)
	createScoreRequestFieldQueueID       = big.NewInt(1 << 10)
	createScoreRequestFieldDataType      = big.NewInt(1 << 11)
	createScoreRequestFieldConfigID      = big.NewInt(1 << 12)
)

type CreateScoreRequest struct {
	ID            *string `json:"id,omitempty" url:"-"`
	TraceID       *string `json:"traceId,omitempty" url:"-"`
	SessionID     *string `json:"sessionId,omitempty" url:"-"`
	ObservationID *string `json:"observationId,omitempty" url:"-"`
	DatasetRunID  *string `json:"datasetRunId,omitempty" url:"-"`
	Name          string  `json:"name" url:"-"`
	// The value of the score. Must be passed as string for categorical scores, and numeric for boolean and numeric scores. Boolean score values must equal either 1 or 0 (true or false)
	Value    *CreateScoreValue      `json:"value" url:"-"`
	Comment  *string                `json:"comment,omitempty" url:"-"`
	Metadata map[string]interface{} `json:"metadata,omitempty" url:"-"`
	// The environment of the score. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.
	Environment *string `json:"environment,omitempty" url:"-"`
	// The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue.
	QueueID *string `json:"queueId,omitempty" url:"-"`
	// The data type of the score. When passing a configId this field is inferred. Otherwise, this field must be passed or will default to numeric.
	DataType *ScoreDataType `json:"dataType,omitempty" url:"-"`
	// Reference a score config on a score. The unique langfuse identifier of a score config. When passing this field, the dataType and stringValue fields are automatically populated.
	ConfigID *string `json:"configId,omitempty" url:"-"`

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

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

// SetID sets the ID field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (c *CreateScoreRequest) SetID(id *string) {
	c.ID = id
	c.require(createScoreRequestFieldID)
}

// SetTraceID sets the TraceID field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (c *CreateScoreRequest) SetTraceID(traceID *string) {
	c.TraceID = traceID
	c.require(createScoreRequestFieldTraceID)
}

// SetSessionID sets the SessionID field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (c *CreateScoreRequest) SetSessionID(sessionID *string) {
	c.SessionID = sessionID
	c.require(createScoreRequestFieldSessionID)
}

// SetObservationID sets the ObservationID field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (c *CreateScoreRequest) SetObservationID(observationID *string) {
	c.ObservationID = observationID
	c.require(createScoreRequestFieldObservationID)
}

// SetDatasetRunID sets the DatasetRunID field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (c *CreateScoreRequest) SetDatasetRunID(datasetRunID *string) {
	c.DatasetRunID = datasetRunID
	c.require(createScoreRequestFieldDatasetRunID)
}

// SetName sets the Name field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (c *CreateScoreRequest) SetName(name string) {
	c.Name = name
	c.require(createScoreRequestFieldName)
}

// SetValue sets the Value field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (c *CreateScoreRequest) SetValue(value *CreateScoreValue) {
	c.Value = value
	c.require(createScoreRequestFieldValue)
}

// SetComment sets the Comment field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (c *CreateScoreRequest) SetComment(comment *string) {
	c.Comment = comment
	c.require(createScoreRequestFieldComment)
}

// SetMetadata sets the Metadata field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (c *CreateScoreRequest) SetMetadata(metadata map[string]interface{}) {
	c.Metadata = metadata
	c.require(createScoreRequestFieldMetadata)
}

// SetEnvironment sets the Environment field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (c *CreateScoreRequest) SetEnvironment(environment *string) {
	c.Environment = environment
	c.require(createScoreRequestFieldEnvironment)
}

// SetQueueID sets the QueueID field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (c *CreateScoreRequest) SetQueueID(queueID *string) {
	c.QueueID = queueID
	c.require(createScoreRequestFieldQueueID)
}

// SetDataType sets the DataType field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (c *CreateScoreRequest) SetDataType(dataType *ScoreDataType) {
	c.DataType = dataType
	c.require(createScoreRequestFieldDataType)
}

// SetConfigID sets the ConfigID field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (c *CreateScoreRequest) SetConfigID(configID *string) {
	c.ConfigID = configID
	c.require(createScoreRequestFieldConfigID)
}

func (c *CreateScoreRequest) UnmarshalJSON(data []byte) error {
	type unmarshaler CreateScoreRequest
	var body unmarshaler
	if err := json.Unmarshal(data, &body); err != nil {
		return err
	}
	*c = CreateScoreRequest(body)
	return nil
}

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

var (
	scoreDeleteRequestFieldScoreID = big.NewInt(1 << 0)
)

type ScoreDeleteRequest struct {
	// The unique langfuse identifier of a score
	ScoreID string `json:"-" url:"-"`

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

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

// SetScoreID sets the ScoreID field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (s *ScoreDeleteRequest) SetScoreID(scoreID string) {
	s.ScoreID = scoreID
	s.require(scoreDeleteRequestFieldScoreID)
}

var (
	createScoreResponseFieldID = big.NewInt(1 << 0)
)

type CreateScoreResponse struct {
	// The id of the created object in Langfuse
	ID string `json:"id" url:"id"`

	// 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 (c *CreateScoreResponse) GetID() string {
	if c == nil {
		return ""
	}
	return c.ID
}

func (c *CreateScoreResponse) GetExtraProperties() map[string]interface{} {
	return c.extraProperties
}

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

// SetID sets the ID field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (c *CreateScoreResponse) SetID(id string) {
	c.ID = id
	c.require(createScoreResponseFieldID)
}

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

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

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