// 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 (
	createDatasetRunItemRequestFieldRunName        = big.NewInt(1 << 0)
	createDatasetRunItemRequestFieldRunDescription = big.NewInt(1 << 1)
	createDatasetRunItemRequestFieldMetadata       = big.NewInt(1 << 2)
	createDatasetRunItemRequestFieldDatasetItemID  = big.NewInt(1 << 3)
	createDatasetRunItemRequestFieldObservationID  = big.NewInt(1 << 4)
	createDatasetRunItemRequestFieldTraceID        = big.NewInt(1 << 5)
)

type CreateDatasetRunItemRequest struct {
	RunName string `json:"runName" url:"-"`
	// Description of the run. If run exists, description will be updated.
	RunDescription *string `json:"runDescription,omitempty" url:"-"`
	// Metadata of the dataset run, updates run if run already exists
	Metadata      interface{} `json:"metadata,omitempty" url:"-"`
	DatasetItemID string      `json:"datasetItemId" url:"-"`
	ObservationID *string     `json:"observationId,omitempty" url:"-"`
	// traceId should always be provided. For compatibility with older SDK versions it can also be inferred from the provided observationId.
	TraceID *string `json:"traceId,omitempty" url:"-"`

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

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

// SetRunName sets the RunName field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (c *CreateDatasetRunItemRequest) SetRunName(runName string) {
	c.RunName = runName
	c.require(createDatasetRunItemRequestFieldRunName)
}

// SetRunDescription sets the RunDescription field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (c *CreateDatasetRunItemRequest) SetRunDescription(runDescription *string) {
	c.RunDescription = runDescription
	c.require(createDatasetRunItemRequestFieldRunDescription)
}

// 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 *CreateDatasetRunItemRequest) SetMetadata(metadata interface{}) {
	c.Metadata = metadata
	c.require(createDatasetRunItemRequestFieldMetadata)
}

// SetDatasetItemID sets the DatasetItemID field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (c *CreateDatasetRunItemRequest) SetDatasetItemID(datasetItemID string) {
	c.DatasetItemID = datasetItemID
	c.require(createDatasetRunItemRequestFieldDatasetItemID)
}

// 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 *CreateDatasetRunItemRequest) SetObservationID(observationID *string) {
	c.ObservationID = observationID
	c.require(createDatasetRunItemRequestFieldObservationID)
}

// 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 *CreateDatasetRunItemRequest) SetTraceID(traceID *string) {
	c.TraceID = traceID
	c.require(createDatasetRunItemRequestFieldTraceID)
}

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

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

var (
	datasetRunItemsListRequestFieldDatasetID = big.NewInt(1 << 0)
	datasetRunItemsListRequestFieldRunName   = big.NewInt(1 << 1)
	datasetRunItemsListRequestFieldPage      = big.NewInt(1 << 2)
	datasetRunItemsListRequestFieldLimit     = big.NewInt(1 << 3)
)

type DatasetRunItemsListRequest struct {
	DatasetID string `json:"-" url:"datasetId"`
	RunName   string `json:"-" url:"runName"`
	// page number, starts at 1
	Page *int `json:"-" url:"page,omitempty"`
	// limit of items per page
	Limit *int `json:"-" url:"limit,omitempty"`

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

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

// SetDatasetID sets the DatasetID field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (d *DatasetRunItemsListRequest) SetDatasetID(datasetID string) {
	d.DatasetID = datasetID
	d.require(datasetRunItemsListRequestFieldDatasetID)
}

// SetRunName sets the RunName field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (d *DatasetRunItemsListRequest) SetRunName(runName string) {
	d.RunName = runName
	d.require(datasetRunItemsListRequestFieldRunName)
}

// SetPage sets the Page field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (d *DatasetRunItemsListRequest) SetPage(page *int) {
	d.Page = page
	d.require(datasetRunItemsListRequestFieldPage)
}

// SetLimit sets the Limit field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (d *DatasetRunItemsListRequest) SetLimit(limit *int) {
	d.Limit = limit
	d.require(datasetRunItemsListRequestFieldLimit)
}

var (
	paginatedDatasetRunItemsFieldData = big.NewInt(1 << 0)
	paginatedDatasetRunItemsFieldMeta = big.NewInt(1 << 1)
)

type PaginatedDatasetRunItems struct {
	Data []*DatasetRunItem  `json:"data" url:"data"`
	Meta *UtilsMetaResponse `json:"meta" url:"meta"`

	// 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 (p *PaginatedDatasetRunItems) GetData() []*DatasetRunItem {
	if p == nil {
		return nil
	}
	return p.Data
}

func (p *PaginatedDatasetRunItems) GetMeta() *UtilsMetaResponse {
	if p == nil {
		return nil
	}
	return p.Meta
}

func (p *PaginatedDatasetRunItems) GetExtraProperties() map[string]interface{} {
	return p.extraProperties
}

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

// SetData sets the Data field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (p *PaginatedDatasetRunItems) SetData(data []*DatasetRunItem) {
	p.Data = data
	p.require(paginatedDatasetRunItemsFieldData)
}

// SetMeta sets the Meta field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (p *PaginatedDatasetRunItems) SetMeta(meta *UtilsMetaResponse) {
	p.Meta = meta
	p.require(paginatedDatasetRunItemsFieldMeta)
}

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

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

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