// 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 (
	projectsCreateRequestFieldName      = big.NewInt(1 << 0)
	projectsCreateRequestFieldMetadata  = big.NewInt(1 << 1)
	projectsCreateRequestFieldRetention = big.NewInt(1 << 2)
)

type ProjectsCreateRequest struct {
	Name string `json:"name" url:"-"`
	// Optional metadata for the project
	Metadata map[string]interface{} `json:"metadata,omitempty" url:"-"`
	// Number of days to retain data. Must be 0 or at least 3 days. Requires data-retention entitlement for non-zero values. Optional.
	Retention int `json:"retention" url:"-"`

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

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

// 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 (p *ProjectsCreateRequest) SetName(name string) {
	p.Name = name
	p.require(projectsCreateRequestFieldName)
}

// 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 (p *ProjectsCreateRequest) SetMetadata(metadata map[string]interface{}) {
	p.Metadata = metadata
	p.require(projectsCreateRequestFieldMetadata)
}

// SetRetention sets the Retention field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (p *ProjectsCreateRequest) SetRetention(retention int) {
	p.Retention = retention
	p.require(projectsCreateRequestFieldRetention)
}

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

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

var (
	projectsCreateAPIKeyRequestFieldProjectID = big.NewInt(1 << 0)
	projectsCreateAPIKeyRequestFieldNote      = big.NewInt(1 << 1)
	projectsCreateAPIKeyRequestFieldPublicKey = big.NewInt(1 << 2)
	projectsCreateAPIKeyRequestFieldSecretKey = big.NewInt(1 << 3)
)

type ProjectsCreateAPIKeyRequest struct {
	ProjectID string `json:"-" url:"-"`
	// Optional note for the API key
	Note *string `json:"note,omitempty" url:"-"`
	// Optional predefined public key. Must start with 'pk-lf-'. If provided, secretKey must also be provided.
	PublicKey *string `json:"publicKey,omitempty" url:"-"`
	// Optional predefined secret key. Must start with 'sk-lf-'. If provided, publicKey must also be provided.
	SecretKey *string `json:"secretKey,omitempty" url:"-"`

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

func (p *ProjectsCreateAPIKeyRequest) require(field *big.Int) {
	if p.explicitFields == nil {
		p.explicitFields = big.NewInt(0)
	}
	p.explicitFields.Or(p.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 (p *ProjectsCreateAPIKeyRequest) SetProjectID(projectID string) {
	p.ProjectID = projectID
	p.require(projectsCreateAPIKeyRequestFieldProjectID)
}

// SetNote sets the Note field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (p *ProjectsCreateAPIKeyRequest) SetNote(note *string) {
	p.Note = note
	p.require(projectsCreateAPIKeyRequestFieldNote)
}

// SetPublicKey sets the PublicKey field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (p *ProjectsCreateAPIKeyRequest) SetPublicKey(publicKey *string) {
	p.PublicKey = publicKey
	p.require(projectsCreateAPIKeyRequestFieldPublicKey)
}

// SetSecretKey sets the SecretKey field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (p *ProjectsCreateAPIKeyRequest) SetSecretKey(secretKey *string) {
	p.SecretKey = secretKey
	p.require(projectsCreateAPIKeyRequestFieldSecretKey)
}

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

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

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

type ProjectsDeleteRequest struct {
	ProjectID string `json:"-" url:"-"`

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

func (p *ProjectsDeleteRequest) require(field *big.Int) {
	if p.explicitFields == nil {
		p.explicitFields = big.NewInt(0)
	}
	p.explicitFields.Or(p.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 (p *ProjectsDeleteRequest) SetProjectID(projectID string) {
	p.ProjectID = projectID
	p.require(projectsDeleteRequestFieldProjectID)
}

var (
	projectsDeleteAPIKeyRequestFieldProjectID = big.NewInt(1 << 0)
	projectsDeleteAPIKeyRequestFieldAPIKeyID  = big.NewInt(1 << 1)
)

type ProjectsDeleteAPIKeyRequest struct {
	ProjectID string `json:"-" url:"-"`
	APIKeyID  string `json:"-" url:"-"`

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

func (p *ProjectsDeleteAPIKeyRequest) require(field *big.Int) {
	if p.explicitFields == nil {
		p.explicitFields = big.NewInt(0)
	}
	p.explicitFields.Or(p.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 (p *ProjectsDeleteAPIKeyRequest) SetProjectID(projectID string) {
	p.ProjectID = projectID
	p.require(projectsDeleteAPIKeyRequestFieldProjectID)
}

// SetAPIKeyID sets the APIKeyID field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (p *ProjectsDeleteAPIKeyRequest) SetAPIKeyID(apiKeyID string) {
	p.APIKeyID = apiKeyID
	p.require(projectsDeleteAPIKeyRequestFieldAPIKeyID)
}

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

type ProjectsGetAPIKeysRequest struct {
	ProjectID string `json:"-" url:"-"`

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

func (p *ProjectsGetAPIKeysRequest) require(field *big.Int) {
	if p.explicitFields == nil {
		p.explicitFields = big.NewInt(0)
	}
	p.explicitFields.Or(p.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 (p *ProjectsGetAPIKeysRequest) SetProjectID(projectID string) {
	p.ProjectID = projectID
	p.require(projectsGetAPIKeysRequestFieldProjectID)
}

// Response for API key deletion
var (
	aPIKeyDeletionResponseFieldSuccess = big.NewInt(1 << 0)
)

type APIKeyDeletionResponse struct {
	Success bool `json:"success" url:"success"`

	// 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 (a *APIKeyDeletionResponse) GetSuccess() bool {
	if a == nil {
		return false
	}
	return a.Success
}

func (a *APIKeyDeletionResponse) GetExtraProperties() map[string]interface{} {
	return a.extraProperties
}

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

// SetSuccess sets the Success field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (a *APIKeyDeletionResponse) SetSuccess(success bool) {
	a.Success = success
	a.require(aPIKeyDeletionResponseFieldSuccess)
}

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

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

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

// List of API keys for a project
var (
	aPIKeyListFieldAPIKeys = big.NewInt(1 << 0)
)

type APIKeyList struct {
	APIKeys []*APIKeySummary `json:"apiKeys" url:"apiKeys"`

	// 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 (a *APIKeyList) GetAPIKeys() []*APIKeySummary {
	if a == nil {
		return nil
	}
	return a.APIKeys
}

func (a *APIKeyList) GetExtraProperties() map[string]interface{} {
	return a.extraProperties
}

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

// SetAPIKeys sets the APIKeys field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (a *APIKeyList) SetAPIKeys(apiKeys []*APIKeySummary) {
	a.APIKeys = apiKeys
	a.require(aPIKeyListFieldAPIKeys)
}

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

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

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

// Response for API key creation
var (
	aPIKeyResponseFieldID               = big.NewInt(1 << 0)
	aPIKeyResponseFieldCreatedAt        = big.NewInt(1 << 1)
	aPIKeyResponseFieldPublicKey        = big.NewInt(1 << 2)
	aPIKeyResponseFieldSecretKey        = big.NewInt(1 << 3)
	aPIKeyResponseFieldDisplaySecretKey = big.NewInt(1 << 4)
	aPIKeyResponseFieldNote             = big.NewInt(1 << 5)
)

type APIKeyResponse struct {
	ID               string    `json:"id" url:"id"`
	CreatedAt        time.Time `json:"createdAt" url:"createdAt"`
	PublicKey        string    `json:"publicKey" url:"publicKey"`
	SecretKey        string    `json:"secretKey" url:"secretKey"`
	DisplaySecretKey string    `json:"displaySecretKey" url:"displaySecretKey"`
	Note             *string   `json:"note,omitempty" url:"note,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 (a *APIKeyResponse) GetID() string {
	if a == nil {
		return ""
	}
	return a.ID
}

func (a *APIKeyResponse) GetCreatedAt() time.Time {
	if a == nil {
		return time.Time{}
	}
	return a.CreatedAt
}

func (a *APIKeyResponse) GetPublicKey() string {
	if a == nil {
		return ""
	}
	return a.PublicKey
}

func (a *APIKeyResponse) GetSecretKey() string {
	if a == nil {
		return ""
	}
	return a.SecretKey
}

func (a *APIKeyResponse) GetDisplaySecretKey() string {
	if a == nil {
		return ""
	}
	return a.DisplaySecretKey
}

func (a *APIKeyResponse) GetNote() *string {
	if a == nil {
		return nil
	}
	return a.Note
}

func (a *APIKeyResponse) GetExtraProperties() map[string]interface{} {
	return a.extraProperties
}

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

// 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 (a *APIKeyResponse) SetCreatedAt(createdAt time.Time) {
	a.CreatedAt = createdAt
	a.require(aPIKeyResponseFieldCreatedAt)
}

// SetPublicKey sets the PublicKey field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (a *APIKeyResponse) SetPublicKey(publicKey string) {
	a.PublicKey = publicKey
	a.require(aPIKeyResponseFieldPublicKey)
}

// SetSecretKey sets the SecretKey field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (a *APIKeyResponse) SetSecretKey(secretKey string) {
	a.SecretKey = secretKey
	a.require(aPIKeyResponseFieldSecretKey)
}

// SetDisplaySecretKey sets the DisplaySecretKey field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (a *APIKeyResponse) SetDisplaySecretKey(displaySecretKey string) {
	a.DisplaySecretKey = displaySecretKey
	a.require(aPIKeyResponseFieldDisplaySecretKey)
}

// SetNote sets the Note field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (a *APIKeyResponse) SetNote(note *string) {
	a.Note = note
	a.require(aPIKeyResponseFieldNote)
}

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

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

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

// Summary of an API key
var (
	aPIKeySummaryFieldID               = big.NewInt(1 << 0)
	aPIKeySummaryFieldCreatedAt        = big.NewInt(1 << 1)
	aPIKeySummaryFieldExpiresAt        = big.NewInt(1 << 2)
	aPIKeySummaryFieldLastUsedAt       = big.NewInt(1 << 3)
	aPIKeySummaryFieldNote             = big.NewInt(1 << 4)
	aPIKeySummaryFieldPublicKey        = big.NewInt(1 << 5)
	aPIKeySummaryFieldDisplaySecretKey = big.NewInt(1 << 6)
)

type APIKeySummary struct {
	ID               string     `json:"id" url:"id"`
	CreatedAt        time.Time  `json:"createdAt" url:"createdAt"`
	ExpiresAt        *time.Time `json:"expiresAt,omitempty" url:"expiresAt,omitempty"`
	LastUsedAt       *time.Time `json:"lastUsedAt,omitempty" url:"lastUsedAt,omitempty"`
	Note             *string    `json:"note,omitempty" url:"note,omitempty"`
	PublicKey        string     `json:"publicKey" url:"publicKey"`
	DisplaySecretKey string     `json:"displaySecretKey" url:"displaySecretKey"`

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

func (a *APIKeySummary) GetCreatedAt() time.Time {
	if a == nil {
		return time.Time{}
	}
	return a.CreatedAt
}

func (a *APIKeySummary) GetExpiresAt() *time.Time {
	if a == nil {
		return nil
	}
	return a.ExpiresAt
}

func (a *APIKeySummary) GetLastUsedAt() *time.Time {
	if a == nil {
		return nil
	}
	return a.LastUsedAt
}

func (a *APIKeySummary) GetNote() *string {
	if a == nil {
		return nil
	}
	return a.Note
}

func (a *APIKeySummary) GetPublicKey() string {
	if a == nil {
		return ""
	}
	return a.PublicKey
}

func (a *APIKeySummary) GetDisplaySecretKey() string {
	if a == nil {
		return ""
	}
	return a.DisplaySecretKey
}

func (a *APIKeySummary) GetExtraProperties() map[string]interface{} {
	return a.extraProperties
}

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

// 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 (a *APIKeySummary) SetCreatedAt(createdAt time.Time) {
	a.CreatedAt = createdAt
	a.require(aPIKeySummaryFieldCreatedAt)
}

// SetExpiresAt sets the ExpiresAt field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (a *APIKeySummary) SetExpiresAt(expiresAt *time.Time) {
	a.ExpiresAt = expiresAt
	a.require(aPIKeySummaryFieldExpiresAt)
}

// SetLastUsedAt sets the LastUsedAt field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (a *APIKeySummary) SetLastUsedAt(lastUsedAt *time.Time) {
	a.LastUsedAt = lastUsedAt
	a.require(aPIKeySummaryFieldLastUsedAt)
}

// SetNote sets the Note field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (a *APIKeySummary) SetNote(note *string) {
	a.Note = note
	a.require(aPIKeySummaryFieldNote)
}

// SetPublicKey sets the PublicKey field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (a *APIKeySummary) SetPublicKey(publicKey string) {
	a.PublicKey = publicKey
	a.require(aPIKeySummaryFieldPublicKey)
}

// SetDisplaySecretKey sets the DisplaySecretKey field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (a *APIKeySummary) SetDisplaySecretKey(displaySecretKey string) {
	a.DisplaySecretKey = displaySecretKey
	a.require(aPIKeySummaryFieldDisplaySecretKey)
}

func (a *APIKeySummary) UnmarshalJSON(data []byte) error {
	type embed APIKeySummary
	var unmarshaler = struct {
		embed
		CreatedAt  *internal.DateTime `json:"createdAt"`
		ExpiresAt  *internal.DateTime `json:"expiresAt,omitempty"`
		LastUsedAt *internal.DateTime `json:"lastUsedAt,omitempty"`
	}{
		embed: embed(*a),
	}
	if err := json.Unmarshal(data, &unmarshaler); err != nil {
		return err
	}
	*a = APIKeySummary(unmarshaler.embed)
	a.CreatedAt = unmarshaler.CreatedAt.Time()
	a.ExpiresAt = unmarshaler.ExpiresAt.TimePtr()
	a.LastUsedAt = unmarshaler.LastUsedAt.TimePtr()
	extraProperties, err := internal.ExtractExtraProperties(data, *a)
	if err != nil {
		return err
	}
	a.extraProperties = extraProperties
	a.rawJSON = json.RawMessage(data)
	return nil
}

func (a *APIKeySummary) MarshalJSON() ([]byte, error) {
	type embed APIKeySummary
	var marshaler = struct {
		embed
		CreatedAt  *internal.DateTime `json:"createdAt"`
		ExpiresAt  *internal.DateTime `json:"expiresAt,omitempty"`
		LastUsedAt *internal.DateTime `json:"lastUsedAt,omitempty"`
	}{
		embed:      embed(*a),
		CreatedAt:  internal.NewDateTime(a.CreatedAt),
		ExpiresAt:  internal.NewOptionalDateTime(a.ExpiresAt),
		LastUsedAt: internal.NewOptionalDateTime(a.LastUsedAt),
	}
	explicitMarshaler := internal.HandleExplicitFields(marshaler, a.explicitFields)
	return json.Marshal(explicitMarshaler)
}

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

var (
	organizationFieldID   = big.NewInt(1 << 0)
	organizationFieldName = big.NewInt(1 << 1)
)

type Organization struct {
	// The unique identifier of the organization
	ID string `json:"id" url:"id"`
	// The name of the organization
	Name string `json:"name" url:"name"`

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

func (o *Organization) GetName() string {
	if o == nil {
		return ""
	}
	return o.Name
}

func (o *Organization) GetExtraProperties() map[string]interface{} {
	return o.extraProperties
}

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

// 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 (o *Organization) SetName(name string) {
	o.Name = name
	o.require(organizationFieldName)
}

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

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

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

var (
	projectFieldID            = big.NewInt(1 << 0)
	projectFieldName          = big.NewInt(1 << 1)
	projectFieldOrganization  = big.NewInt(1 << 2)
	projectFieldMetadata      = big.NewInt(1 << 3)
	projectFieldRetentionDays = big.NewInt(1 << 4)
)

type Project struct {
	ID   string `json:"id" url:"id"`
	Name string `json:"name" url:"name"`
	// The organization this project belongs to
	Organization *Organization `json:"organization" url:"organization"`
	// Metadata for the project
	Metadata map[string]interface{} `json:"metadata" url:"metadata"`
	// Number of days to retain data. Null or 0 means no retention. Omitted if no retention is configured.
	RetentionDays *int `json:"retentionDays,omitempty" url:"retentionDays,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 (p *Project) GetID() string {
	if p == nil {
		return ""
	}
	return p.ID
}

func (p *Project) GetName() string {
	if p == nil {
		return ""
	}
	return p.Name
}

func (p *Project) GetOrganization() *Organization {
	if p == nil {
		return nil
	}
	return p.Organization
}

func (p *Project) GetMetadata() map[string]interface{} {
	if p == nil {
		return nil
	}
	return p.Metadata
}

func (p *Project) GetRetentionDays() *int {
	if p == nil {
		return nil
	}
	return p.RetentionDays
}

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

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

// 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 (p *Project) SetName(name string) {
	p.Name = name
	p.require(projectFieldName)
}

// SetOrganization sets the Organization field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (p *Project) SetOrganization(organization *Organization) {
	p.Organization = organization
	p.require(projectFieldOrganization)
}

// 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 (p *Project) SetMetadata(metadata map[string]interface{}) {
	p.Metadata = metadata
	p.require(projectFieldMetadata)
}

// SetRetentionDays sets the RetentionDays field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (p *Project) SetRetentionDays(retentionDays *int) {
	p.RetentionDays = retentionDays
	p.require(projectFieldRetentionDays)
}

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

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

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

var (
	projectDeletionResponseFieldSuccess = big.NewInt(1 << 0)
	projectDeletionResponseFieldMessage = big.NewInt(1 << 1)
)

type ProjectDeletionResponse struct {
	Success bool   `json:"success" url:"success"`
	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 (p *ProjectDeletionResponse) GetSuccess() bool {
	if p == nil {
		return false
	}
	return p.Success
}

func (p *ProjectDeletionResponse) GetMessage() string {
	if p == nil {
		return ""
	}
	return p.Message
}

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

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

// SetSuccess sets the Success field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (p *ProjectDeletionResponse) SetSuccess(success bool) {
	p.Success = success
	p.require(projectDeletionResponseFieldSuccess)
}

// 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 (p *ProjectDeletionResponse) SetMessage(message string) {
	p.Message = message
	p.require(projectDeletionResponseFieldMessage)
}

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

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

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

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

type Projects struct {
	Data []*Project `json:"data" url:"data"`

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

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

func (p *Projects) 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 *Projects) SetData(data []*Project) {
	p.Data = data
	p.require(projectsFieldData)
}

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

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

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

var (
	projectsUpdateRequestFieldProjectID = big.NewInt(1 << 0)
	projectsUpdateRequestFieldName      = big.NewInt(1 << 1)
	projectsUpdateRequestFieldMetadata  = big.NewInt(1 << 2)
	projectsUpdateRequestFieldRetention = big.NewInt(1 << 3)
)

type ProjectsUpdateRequest struct {
	ProjectID string `json:"-" url:"-"`
	Name      string `json:"name" url:"-"`
	// Optional metadata for the project
	Metadata map[string]interface{} `json:"metadata,omitempty" url:"-"`
	// Number of days to retain data.
	// Must be 0 or at least 3 days.
	// Requires data-retention entitlement for non-zero values.
	// Optional. Will retain existing retention setting if omitted.
	Retention *int `json:"retention,omitempty" url:"-"`

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

func (p *ProjectsUpdateRequest) require(field *big.Int) {
	if p.explicitFields == nil {
		p.explicitFields = big.NewInt(0)
	}
	p.explicitFields.Or(p.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 (p *ProjectsUpdateRequest) SetProjectID(projectID string) {
	p.ProjectID = projectID
	p.require(projectsUpdateRequestFieldProjectID)
}

// 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 (p *ProjectsUpdateRequest) SetName(name string) {
	p.Name = name
	p.require(projectsUpdateRequestFieldName)
}

// 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 (p *ProjectsUpdateRequest) SetMetadata(metadata map[string]interface{}) {
	p.Metadata = metadata
	p.require(projectsUpdateRequestFieldMetadata)
}

// SetRetention sets the Retention field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (p *ProjectsUpdateRequest) SetRetention(retention *int) {
	p.Retention = retention
	p.require(projectsUpdateRequestFieldRetention)
}

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

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