// 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 (
	createCommentRequestFieldProjectID    = big.NewInt(1 << 0)
	createCommentRequestFieldObjectType   = big.NewInt(1 << 1)
	createCommentRequestFieldObjectID     = big.NewInt(1 << 2)
	createCommentRequestFieldContent      = big.NewInt(1 << 3)
	createCommentRequestFieldAuthorUserID = big.NewInt(1 << 4)
)

type CreateCommentRequest struct {
	// The id of the project to attach the comment to.
	ProjectID string `json:"projectId" url:"-"`
	// The type of the object to attach the comment to (trace, observation, session, prompt).
	ObjectType string `json:"objectType" url:"-"`
	// The id of the object to attach the comment to. If this does not reference a valid existing object, an error will be thrown.
	ObjectID string `json:"objectId" url:"-"`
	// The content of the comment. May include markdown. Currently limited to 5000 characters.
	Content string `json:"content" url:"-"`
	// The id of the user who created the comment.
	AuthorUserID *string `json:"authorUserId,omitempty" url:"-"`

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

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

// SetProjectID sets the ProjectID field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (c *CreateCommentRequest) SetProjectID(projectID string) {
	c.ProjectID = projectID
	c.require(createCommentRequestFieldProjectID)
}

// SetObjectType sets the ObjectType field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (c *CreateCommentRequest) SetObjectType(objectType string) {
	c.ObjectType = objectType
	c.require(createCommentRequestFieldObjectType)
}

// SetObjectID sets the ObjectID field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (c *CreateCommentRequest) SetObjectID(objectID string) {
	c.ObjectID = objectID
	c.require(createCommentRequestFieldObjectID)
}

// SetContent sets the Content field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (c *CreateCommentRequest) SetContent(content string) {
	c.Content = content
	c.require(createCommentRequestFieldContent)
}

// SetAuthorUserID sets the AuthorUserID field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (c *CreateCommentRequest) SetAuthorUserID(authorUserID *string) {
	c.AuthorUserID = authorUserID
	c.require(createCommentRequestFieldAuthorUserID)
}

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

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

var (
	commentsGetRequestFieldPage         = big.NewInt(1 << 0)
	commentsGetRequestFieldLimit        = big.NewInt(1 << 1)
	commentsGetRequestFieldObjectType   = big.NewInt(1 << 2)
	commentsGetRequestFieldObjectID     = big.NewInt(1 << 3)
	commentsGetRequestFieldAuthorUserID = big.NewInt(1 << 4)
)

type CommentsGetRequest struct {
	// Page number, starts at 1.
	Page *int `json:"-" url:"page,omitempty"`
	// Limit of items per page. If you encounter api issues due to too large page sizes, try to reduce the limit
	Limit *int `json:"-" url:"limit,omitempty"`
	// Filter comments by object type (trace, observation, session, prompt).
	ObjectType *string `json:"-" url:"objectType,omitempty"`
	// Filter comments by object id. If objectType is not provided, an error will be thrown.
	ObjectID *string `json:"-" url:"objectId,omitempty"`
	// Filter comments by author user id.
	AuthorUserID *string `json:"-" url:"authorUserId,omitempty"`

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

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

// 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 (c *CommentsGetRequest) SetPage(page *int) {
	c.Page = page
	c.require(commentsGetRequestFieldPage)
}

// 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 (c *CommentsGetRequest) SetLimit(limit *int) {
	c.Limit = limit
	c.require(commentsGetRequestFieldLimit)
}

// SetObjectType sets the ObjectType field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (c *CommentsGetRequest) SetObjectType(objectType *string) {
	c.ObjectType = objectType
	c.require(commentsGetRequestFieldObjectType)
}

// SetObjectID sets the ObjectID field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (c *CommentsGetRequest) SetObjectID(objectID *string) {
	c.ObjectID = objectID
	c.require(commentsGetRequestFieldObjectID)
}

// SetAuthorUserID sets the AuthorUserID field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (c *CommentsGetRequest) SetAuthorUserID(authorUserID *string) {
	c.AuthorUserID = authorUserID
	c.require(commentsGetRequestFieldAuthorUserID)
}

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

type CommentsGetByIDRequest struct {
	// The unique langfuse identifier of a comment
	CommentID string `json:"-" url:"-"`

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

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

// SetCommentID sets the CommentID field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (c *CommentsGetByIDRequest) SetCommentID(commentID string) {
	c.CommentID = commentID
	c.require(commentsGetByIDRequestFieldCommentID)
}

var (
	commentFieldID           = big.NewInt(1 << 0)
	commentFieldProjectID    = big.NewInt(1 << 1)
	commentFieldCreatedAt    = big.NewInt(1 << 2)
	commentFieldUpdatedAt    = big.NewInt(1 << 3)
	commentFieldObjectType   = big.NewInt(1 << 4)
	commentFieldObjectID     = big.NewInt(1 << 5)
	commentFieldContent      = big.NewInt(1 << 6)
	commentFieldAuthorUserID = big.NewInt(1 << 7)
)

type Comment struct {
	ID         string            `json:"id" url:"id"`
	ProjectID  string            `json:"projectId" url:"projectId"`
	CreatedAt  time.Time         `json:"createdAt" url:"createdAt"`
	UpdatedAt  time.Time         `json:"updatedAt" url:"updatedAt"`
	ObjectType CommentObjectType `json:"objectType" url:"objectType"`
	ObjectID   string            `json:"objectId" url:"objectId"`
	Content    string            `json:"content" url:"content"`
	// The user ID of the comment author
	AuthorUserID *string `json:"authorUserId,omitempty" url:"authorUserId,omitempty"`

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

func (c *Comment) GetProjectID() string {
	if c == nil {
		return ""
	}
	return c.ProjectID
}

func (c *Comment) GetCreatedAt() time.Time {
	if c == nil {
		return time.Time{}
	}
	return c.CreatedAt
}

func (c *Comment) GetUpdatedAt() time.Time {
	if c == nil {
		return time.Time{}
	}
	return c.UpdatedAt
}

func (c *Comment) GetObjectType() CommentObjectType {
	if c == nil {
		return ""
	}
	return c.ObjectType
}

func (c *Comment) GetObjectID() string {
	if c == nil {
		return ""
	}
	return c.ObjectID
}

func (c *Comment) GetContent() string {
	if c == nil {
		return ""
	}
	return c.Content
}

func (c *Comment) GetAuthorUserID() *string {
	if c == nil {
		return nil
	}
	return c.AuthorUserID
}

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

func (c *Comment) 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 *Comment) SetID(id string) {
	c.ID = id
	c.require(commentFieldID)
}

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

// 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 (c *Comment) SetCreatedAt(createdAt time.Time) {
	c.CreatedAt = createdAt
	c.require(commentFieldCreatedAt)
}

// 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 (c *Comment) SetUpdatedAt(updatedAt time.Time) {
	c.UpdatedAt = updatedAt
	c.require(commentFieldUpdatedAt)
}

// SetObjectType sets the ObjectType field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (c *Comment) SetObjectType(objectType CommentObjectType) {
	c.ObjectType = objectType
	c.require(commentFieldObjectType)
}

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

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

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

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

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

func (c *Comment) 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)
}

type CommentObjectType string

const (
	CommentObjectTypeTrace       CommentObjectType = "TRACE"
	CommentObjectTypeObservation CommentObjectType = "OBSERVATION"
	CommentObjectTypeSession     CommentObjectType = "SESSION"
	CommentObjectTypePrompt      CommentObjectType = "PROMPT"
)

func NewCommentObjectTypeFromString(s string) (CommentObjectType, error) {
	switch s {
	case "TRACE":
		return CommentObjectTypeTrace, nil
	case "OBSERVATION":
		return CommentObjectTypeObservation, nil
	case "SESSION":
		return CommentObjectTypeSession, nil
	case "PROMPT":
		return CommentObjectTypePrompt, nil
	}
	var t CommentObjectType
	return "", fmt.Errorf("%s is not a valid %T", s, t)
}

func (c CommentObjectType) Ptr() *CommentObjectType {
	return &c
}

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

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

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

func (c *CreateCommentResponse) 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 *CreateCommentResponse) SetID(id string) {
	c.ID = id
	c.require(createCommentResponseFieldID)
}

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

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

func (c *CreateCommentResponse) 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)
}

var (
	getCommentsResponseFieldData = big.NewInt(1 << 0)
	getCommentsResponseFieldMeta = big.NewInt(1 << 1)
)

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

func (g *GetCommentsResponse) GetMeta() *UtilsMetaResponse {
	if g == nil {
		return nil
	}
	return g.Meta
}

func (g *GetCommentsResponse) GetExtraProperties() map[string]interface{} {
	return g.extraProperties
}

func (g *GetCommentsResponse) require(field *big.Int) {
	if g.explicitFields == nil {
		g.explicitFields = big.NewInt(0)
	}
	g.explicitFields.Or(g.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 (g *GetCommentsResponse) SetData(data []*Comment) {
	g.Data = data
	g.require(getCommentsResponseFieldData)
}

// 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 (g *GetCommentsResponse) SetMeta(meta *UtilsMetaResponse) {
	g.Meta = meta
	g.require(getCommentsResponseFieldMeta)
}

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

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

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