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

var (
	createDatasetItemRequestFieldDatasetName         = big.NewInt(1 << 0)
	createDatasetItemRequestFieldInput               = big.NewInt(1 << 1)
	createDatasetItemRequestFieldExpectedOutput      = big.NewInt(1 << 2)
	createDatasetItemRequestFieldMetadata            = big.NewInt(1 << 3)
	createDatasetItemRequestFieldSourceTraceID       = big.NewInt(1 << 4)
	createDatasetItemRequestFieldSourceObservationID = big.NewInt(1 << 5)
	createDatasetItemRequestFieldID                  = big.NewInt(1 << 6)
	createDatasetItemRequestFieldStatus              = big.NewInt(1 << 7)
)

type CreateDatasetItemRequest struct {
	DatasetName         string      `json:"datasetName" url:"-"`
	Input               interface{} `json:"input,omitempty" url:"-"`
	ExpectedOutput      interface{} `json:"expectedOutput,omitempty" url:"-"`
	Metadata            interface{} `json:"metadata,omitempty" url:"-"`
	SourceTraceID       *string     `json:"sourceTraceId,omitempty" url:"-"`
	SourceObservationID *string     `json:"sourceObservationId,omitempty" url:"-"`
	// Dataset items are upserted on their id. Id needs to be unique (project-level) and cannot be reused across datasets.
	ID *string `json:"id,omitempty" url:"-"`
	// Defaults to ACTIVE for newly created items
	Status *DatasetStatus `json:"status,omitempty" url:"-"`

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

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

// SetDatasetName sets the DatasetName field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (c *CreateDatasetItemRequest) SetDatasetName(datasetName string) {
	c.DatasetName = datasetName
	c.require(createDatasetItemRequestFieldDatasetName)
}

// SetInput sets the Input field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (c *CreateDatasetItemRequest) SetInput(input interface{}) {
	c.Input = input
	c.require(createDatasetItemRequestFieldInput)
}

// SetExpectedOutput sets the ExpectedOutput field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (c *CreateDatasetItemRequest) SetExpectedOutput(expectedOutput interface{}) {
	c.ExpectedOutput = expectedOutput
	c.require(createDatasetItemRequestFieldExpectedOutput)
}

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

// SetSourceTraceID sets the SourceTraceID field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (c *CreateDatasetItemRequest) SetSourceTraceID(sourceTraceID *string) {
	c.SourceTraceID = sourceTraceID
	c.require(createDatasetItemRequestFieldSourceTraceID)
}

// SetSourceObservationID sets the SourceObservationID field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (c *CreateDatasetItemRequest) SetSourceObservationID(sourceObservationID *string) {
	c.SourceObservationID = sourceObservationID
	c.require(createDatasetItemRequestFieldSourceObservationID)
}

// 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 *CreateDatasetItemRequest) SetID(id *string) {
	c.ID = id
	c.require(createDatasetItemRequestFieldID)
}

// 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 (c *CreateDatasetItemRequest) SetStatus(status *DatasetStatus) {
	c.Status = status
	c.require(createDatasetItemRequestFieldStatus)
}

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

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

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

type DatasetItemsDeleteRequest struct {
	ID string `json:"-" url:"-"`

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

func (d *DatasetItemsDeleteRequest) require(field *big.Int) {
	if d.explicitFields == nil {
		d.explicitFields = big.NewInt(0)
	}
	d.explicitFields.Or(d.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 (d *DatasetItemsDeleteRequest) SetID(id string) {
	d.ID = id
	d.require(datasetItemsDeleteRequestFieldID)
}

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

type DatasetItemsGetRequest struct {
	ID string `json:"-" url:"-"`

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

func (d *DatasetItemsGetRequest) require(field *big.Int) {
	if d.explicitFields == nil {
		d.explicitFields = big.NewInt(0)
	}
	d.explicitFields.Or(d.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 (d *DatasetItemsGetRequest) SetID(id string) {
	d.ID = id
	d.require(datasetItemsGetRequestFieldID)
}

var (
	datasetItemsListRequestFieldDatasetName         = big.NewInt(1 << 0)
	datasetItemsListRequestFieldSourceTraceID       = big.NewInt(1 << 1)
	datasetItemsListRequestFieldSourceObservationID = big.NewInt(1 << 2)
	datasetItemsListRequestFieldPage                = big.NewInt(1 << 3)
	datasetItemsListRequestFieldLimit               = big.NewInt(1 << 4)
)

type DatasetItemsListRequest struct {
	DatasetName         *string `json:"-" url:"datasetName,omitempty"`
	SourceTraceID       *string `json:"-" url:"sourceTraceId,omitempty"`
	SourceObservationID *string `json:"-" url:"sourceObservationId,omitempty"`
	// 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 *DatasetItemsListRequest) require(field *big.Int) {
	if d.explicitFields == nil {
		d.explicitFields = big.NewInt(0)
	}
	d.explicitFields.Or(d.explicitFields, field)
}

// SetDatasetName sets the DatasetName field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (d *DatasetItemsListRequest) SetDatasetName(datasetName *string) {
	d.DatasetName = datasetName
	d.require(datasetItemsListRequestFieldDatasetName)
}

// SetSourceTraceID sets the SourceTraceID field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (d *DatasetItemsListRequest) SetSourceTraceID(sourceTraceID *string) {
	d.SourceTraceID = sourceTraceID
	d.require(datasetItemsListRequestFieldSourceTraceID)
}

// SetSourceObservationID sets the SourceObservationID field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (d *DatasetItemsListRequest) SetSourceObservationID(sourceObservationID *string) {
	d.SourceObservationID = sourceObservationID
	d.require(datasetItemsListRequestFieldSourceObservationID)
}

// 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 *DatasetItemsListRequest) SetPage(page *int) {
	d.Page = page
	d.require(datasetItemsListRequestFieldPage)
}

// 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 *DatasetItemsListRequest) SetLimit(limit *int) {
	d.Limit = limit
	d.require(datasetItemsListRequestFieldLimit)
}

var (
	datasetItemFieldID                  = big.NewInt(1 << 0)
	datasetItemFieldStatus              = big.NewInt(1 << 1)
	datasetItemFieldInput               = big.NewInt(1 << 2)
	datasetItemFieldExpectedOutput      = big.NewInt(1 << 3)
	datasetItemFieldMetadata            = big.NewInt(1 << 4)
	datasetItemFieldSourceTraceID       = big.NewInt(1 << 5)
	datasetItemFieldSourceObservationID = big.NewInt(1 << 6)
	datasetItemFieldDatasetID           = big.NewInt(1 << 7)
	datasetItemFieldDatasetName         = big.NewInt(1 << 8)
	datasetItemFieldCreatedAt           = big.NewInt(1 << 9)
	datasetItemFieldUpdatedAt           = big.NewInt(1 << 10)
)

type DatasetItem struct {
	ID             string        `json:"id" url:"id"`
	Status         DatasetStatus `json:"status" url:"status"`
	Input          interface{}   `json:"input" url:"input"`
	ExpectedOutput interface{}   `json:"expectedOutput" url:"expectedOutput"`
	Metadata       interface{}   `json:"metadata" url:"metadata"`
	// The trace ID that sourced this dataset item
	SourceTraceID *string `json:"sourceTraceId,omitempty" url:"sourceTraceId,omitempty"`
	// The observation ID that sourced this dataset item
	SourceObservationID *string   `json:"sourceObservationId,omitempty" url:"sourceObservationId,omitempty"`
	DatasetID           string    `json:"datasetId" url:"datasetId"`
	DatasetName         string    `json:"datasetName" url:"datasetName"`
	CreatedAt           time.Time `json:"createdAt" url:"createdAt"`
	UpdatedAt           time.Time `json:"updatedAt" url:"updatedAt"`

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

func (d *DatasetItem) GetStatus() DatasetStatus {
	if d == nil {
		return ""
	}
	return d.Status
}

func (d *DatasetItem) GetInput() interface{} {
	if d == nil {
		return nil
	}
	return d.Input
}

func (d *DatasetItem) GetExpectedOutput() interface{} {
	if d == nil {
		return nil
	}
	return d.ExpectedOutput
}

func (d *DatasetItem) GetMetadata() interface{} {
	if d == nil {
		return nil
	}
	return d.Metadata
}

func (d *DatasetItem) GetSourceTraceID() *string {
	if d == nil {
		return nil
	}
	return d.SourceTraceID
}

func (d *DatasetItem) GetSourceObservationID() *string {
	if d == nil {
		return nil
	}
	return d.SourceObservationID
}

func (d *DatasetItem) GetDatasetID() string {
	if d == nil {
		return ""
	}
	return d.DatasetID
}

func (d *DatasetItem) GetDatasetName() string {
	if d == nil {
		return ""
	}
	return d.DatasetName
}

func (d *DatasetItem) GetCreatedAt() time.Time {
	if d == nil {
		return time.Time{}
	}
	return d.CreatedAt
}

func (d *DatasetItem) GetUpdatedAt() time.Time {
	if d == nil {
		return time.Time{}
	}
	return d.UpdatedAt
}

func (d *DatasetItem) GetExtraProperties() map[string]interface{} {
	return d.extraProperties
}

func (d *DatasetItem) require(field *big.Int) {
	if d.explicitFields == nil {
		d.explicitFields = big.NewInt(0)
	}
	d.explicitFields.Or(d.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 (d *DatasetItem) SetID(id string) {
	d.ID = id
	d.require(datasetItemFieldID)
}

// 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 (d *DatasetItem) SetStatus(status DatasetStatus) {
	d.Status = status
	d.require(datasetItemFieldStatus)
}

// SetInput sets the Input field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (d *DatasetItem) SetInput(input interface{}) {
	d.Input = input
	d.require(datasetItemFieldInput)
}

// SetExpectedOutput sets the ExpectedOutput field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (d *DatasetItem) SetExpectedOutput(expectedOutput interface{}) {
	d.ExpectedOutput = expectedOutput
	d.require(datasetItemFieldExpectedOutput)
}

// 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 (d *DatasetItem) SetMetadata(metadata interface{}) {
	d.Metadata = metadata
	d.require(datasetItemFieldMetadata)
}

// SetSourceTraceID sets the SourceTraceID field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (d *DatasetItem) SetSourceTraceID(sourceTraceID *string) {
	d.SourceTraceID = sourceTraceID
	d.require(datasetItemFieldSourceTraceID)
}

// SetSourceObservationID sets the SourceObservationID field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (d *DatasetItem) SetSourceObservationID(sourceObservationID *string) {
	d.SourceObservationID = sourceObservationID
	d.require(datasetItemFieldSourceObservationID)
}

// 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 *DatasetItem) SetDatasetID(datasetID string) {
	d.DatasetID = datasetID
	d.require(datasetItemFieldDatasetID)
}

// SetDatasetName sets the DatasetName field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (d *DatasetItem) SetDatasetName(datasetName string) {
	d.DatasetName = datasetName
	d.require(datasetItemFieldDatasetName)
}

// SetCreatedAt sets the CreatedAt field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (d *DatasetItem) SetCreatedAt(createdAt time.Time) {
	d.CreatedAt = createdAt
	d.require(datasetItemFieldCreatedAt)
}

// SetUpdatedAt sets the UpdatedAt field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (d *DatasetItem) SetUpdatedAt(updatedAt time.Time) {
	d.UpdatedAt = updatedAt
	d.require(datasetItemFieldUpdatedAt)
}

func (d *DatasetItem) UnmarshalJSON(data []byte) error {
	type embed DatasetItem
	var unmarshaler = struct {
		embed
		CreatedAt *internal.DateTime `json:"createdAt"`
		UpdatedAt *internal.DateTime `json:"updatedAt"`
	}{
		embed: embed(*d),
	}
	if err := json.Unmarshal(data, &unmarshaler); err != nil {
		return err
	}
	*d = DatasetItem(unmarshaler.embed)
	d.CreatedAt = unmarshaler.CreatedAt.Time()
	d.UpdatedAt = unmarshaler.UpdatedAt.Time()
	extraProperties, err := internal.ExtractExtraProperties(data, *d)
	if err != nil {
		return err
	}
	d.extraProperties = extraProperties
	d.rawJSON = json.RawMessage(data)
	return nil
}

func (d *DatasetItem) MarshalJSON() ([]byte, error) {
	type embed DatasetItem
	var marshaler = struct {
		embed
		CreatedAt *internal.DateTime `json:"createdAt"`
		UpdatedAt *internal.DateTime `json:"updatedAt"`
	}{
		embed:     embed(*d),
		CreatedAt: internal.NewDateTime(d.CreatedAt),
		UpdatedAt: internal.NewDateTime(d.UpdatedAt),
	}
	explicitMarshaler := internal.HandleExplicitFields(marshaler, d.explicitFields)
	return json.Marshal(explicitMarshaler)
}

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

type DatasetStatus string

const (
	DatasetStatusActive   DatasetStatus = "ACTIVE"
	DatasetStatusArchived DatasetStatus = "ARCHIVED"
)

func NewDatasetStatusFromString(s string) (DatasetStatus, error) {
	switch s {
	case "ACTIVE":
		return DatasetStatusActive, nil
	case "ARCHIVED":
		return DatasetStatusArchived, nil
	}
	var t DatasetStatus
	return "", fmt.Errorf("%s is not a valid %T", s, t)
}

func (d DatasetStatus) Ptr() *DatasetStatus {
	return &d
}

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

type DeleteDatasetItemResponse struct {
	// Success message after deletion
	Message string `json:"message" url:"message"`

	// 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 (d *DeleteDatasetItemResponse) GetMessage() string {
	if d == nil {
		return ""
	}
	return d.Message
}

func (d *DeleteDatasetItemResponse) GetExtraProperties() map[string]interface{} {
	return d.extraProperties
}

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

// SetMessage sets the Message field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (d *DeleteDatasetItemResponse) SetMessage(message string) {
	d.Message = message
	d.require(deleteDatasetItemResponseFieldMessage)
}

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

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

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

var (
	paginatedDatasetItemsFieldData = big.NewInt(1 << 0)
	paginatedDatasetItemsFieldMeta = big.NewInt(1 << 1)
)

type PaginatedDatasetItems struct {
	Data []*DatasetItem     `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 *PaginatedDatasetItems) GetData() []*DatasetItem {
	if p == nil {
		return nil
	}
	return p.Data
}

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

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

func (p *PaginatedDatasetItems) 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 *PaginatedDatasetItems) SetData(data []*DatasetItem) {
	p.Data = data
	p.require(paginatedDatasetItemsFieldData)
}

// 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 *PaginatedDatasetItems) SetMeta(meta *UtilsMetaResponse) {
	p.Meta = meta
	p.require(paginatedDatasetItemsFieldMeta)
}

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

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

func (p *PaginatedDatasetItems) 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)
}
