// 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 (
	organizationsDeleteProjectMembershipRequestFieldProjectID = big.NewInt(1 << 0)
)

type OrganizationsDeleteProjectMembershipRequest struct {
	ProjectID string                   `json:"-" url:"-"`
	Body      *DeleteMembershipRequest `json:"-" url:"-"`

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

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

func (o *OrganizationsDeleteProjectMembershipRequest) UnmarshalJSON(data []byte) error {
	body := new(DeleteMembershipRequest)
	if err := json.Unmarshal(data, &body); err != nil {
		return err
	}
	o.Body = body
	return nil
}

func (o *OrganizationsDeleteProjectMembershipRequest) MarshalJSON() ([]byte, error) {
	return json.Marshal(o.Body)
}

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

type OrganizationsGetProjectMembershipsRequest 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 (o *OrganizationsGetProjectMembershipsRequest) require(field *big.Int) {
	if o.explicitFields == nil {
		o.explicitFields = big.NewInt(0)
	}
	o.explicitFields.Or(o.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 (o *OrganizationsGetProjectMembershipsRequest) SetProjectID(projectID string) {
	o.ProjectID = projectID
	o.require(organizationsGetProjectMembershipsRequestFieldProjectID)
}

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

type DeleteMembershipRequest struct {
	UserID string `json:"userId" url:"userId"`

	// 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 *DeleteMembershipRequest) GetUserID() string {
	if d == nil {
		return ""
	}
	return d.UserID
}

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

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

// SetUserID sets the UserID field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (d *DeleteMembershipRequest) SetUserID(userID string) {
	d.UserID = userID
	d.require(deleteMembershipRequestFieldUserID)
}

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

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

func (d *DeleteMembershipRequest) 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 (
	membershipDeletionResponseFieldMessage = big.NewInt(1 << 0)
	membershipDeletionResponseFieldUserID  = big.NewInt(1 << 1)
)

type MembershipDeletionResponse struct {
	Message string `json:"message" url:"message"`
	UserID  string `json:"userId" url:"userId"`

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

func (m *MembershipDeletionResponse) GetUserID() string {
	if m == nil {
		return ""
	}
	return m.UserID
}

func (m *MembershipDeletionResponse) GetExtraProperties() map[string]interface{} {
	return m.extraProperties
}

func (m *MembershipDeletionResponse) require(field *big.Int) {
	if m.explicitFields == nil {
		m.explicitFields = big.NewInt(0)
	}
	m.explicitFields.Or(m.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 (m *MembershipDeletionResponse) SetMessage(message string) {
	m.Message = message
	m.require(membershipDeletionResponseFieldMessage)
}

// SetUserID sets the UserID field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (m *MembershipDeletionResponse) SetUserID(userID string) {
	m.UserID = userID
	m.require(membershipDeletionResponseFieldUserID)
}

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

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

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

var (
	membershipRequestFieldUserID = big.NewInt(1 << 0)
	membershipRequestFieldRole   = big.NewInt(1 << 1)
)

type MembershipRequest struct {
	UserID string         `json:"userId" url:"userId"`
	Role   MembershipRole `json:"role" url:"role"`

	// 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 (m *MembershipRequest) GetUserID() string {
	if m == nil {
		return ""
	}
	return m.UserID
}

func (m *MembershipRequest) GetRole() MembershipRole {
	if m == nil {
		return ""
	}
	return m.Role
}

func (m *MembershipRequest) GetExtraProperties() map[string]interface{} {
	return m.extraProperties
}

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

// SetUserID sets the UserID field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (m *MembershipRequest) SetUserID(userID string) {
	m.UserID = userID
	m.require(membershipRequestFieldUserID)
}

// SetRole sets the Role field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (m *MembershipRequest) SetRole(role MembershipRole) {
	m.Role = role
	m.require(membershipRequestFieldRole)
}

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

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

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

var (
	membershipResponseFieldUserID = big.NewInt(1 << 0)
	membershipResponseFieldRole   = big.NewInt(1 << 1)
	membershipResponseFieldEmail  = big.NewInt(1 << 2)
	membershipResponseFieldName   = big.NewInt(1 << 3)
)

type MembershipResponse struct {
	UserID string         `json:"userId" url:"userId"`
	Role   MembershipRole `json:"role" url:"role"`
	Email  string         `json:"email" url:"email"`
	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 (m *MembershipResponse) GetUserID() string {
	if m == nil {
		return ""
	}
	return m.UserID
}

func (m *MembershipResponse) GetRole() MembershipRole {
	if m == nil {
		return ""
	}
	return m.Role
}

func (m *MembershipResponse) GetEmail() string {
	if m == nil {
		return ""
	}
	return m.Email
}

func (m *MembershipResponse) GetName() string {
	if m == nil {
		return ""
	}
	return m.Name
}

func (m *MembershipResponse) GetExtraProperties() map[string]interface{} {
	return m.extraProperties
}

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

// SetUserID sets the UserID field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (m *MembershipResponse) SetUserID(userID string) {
	m.UserID = userID
	m.require(membershipResponseFieldUserID)
}

// SetRole sets the Role field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (m *MembershipResponse) SetRole(role MembershipRole) {
	m.Role = role
	m.require(membershipResponseFieldRole)
}

// SetEmail sets the Email field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (m *MembershipResponse) SetEmail(email string) {
	m.Email = email
	m.require(membershipResponseFieldEmail)
}

// 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 (m *MembershipResponse) SetName(name string) {
	m.Name = name
	m.require(membershipResponseFieldName)
}

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

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

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

type MembershipRole string

const (
	MembershipRoleOwner  MembershipRole = "OWNER"
	MembershipRoleAdmin  MembershipRole = "ADMIN"
	MembershipRoleMember MembershipRole = "MEMBER"
	MembershipRoleViewer MembershipRole = "VIEWER"
)

func NewMembershipRoleFromString(s string) (MembershipRole, error) {
	switch s {
	case "OWNER":
		return MembershipRoleOwner, nil
	case "ADMIN":
		return MembershipRoleAdmin, nil
	case "MEMBER":
		return MembershipRoleMember, nil
	case "VIEWER":
		return MembershipRoleViewer, nil
	}
	var t MembershipRole
	return "", fmt.Errorf("%s is not a valid %T", s, t)
}

func (m MembershipRole) Ptr() *MembershipRole {
	return &m
}

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

type MembershipsResponse struct {
	Memberships []*MembershipResponse `json:"memberships" url:"memberships"`

	// 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 (m *MembershipsResponse) GetMemberships() []*MembershipResponse {
	if m == nil {
		return nil
	}
	return m.Memberships
}

func (m *MembershipsResponse) GetExtraProperties() map[string]interface{} {
	return m.extraProperties
}

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

// SetMemberships sets the Memberships field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (m *MembershipsResponse) SetMemberships(memberships []*MembershipResponse) {
	m.Memberships = memberships
	m.require(membershipsResponseFieldMemberships)
}

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

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

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

var (
	organizationAPIKeyFieldID               = big.NewInt(1 << 0)
	organizationAPIKeyFieldCreatedAt        = big.NewInt(1 << 1)
	organizationAPIKeyFieldExpiresAt        = big.NewInt(1 << 2)
	organizationAPIKeyFieldLastUsedAt       = big.NewInt(1 << 3)
	organizationAPIKeyFieldNote             = big.NewInt(1 << 4)
	organizationAPIKeyFieldPublicKey        = big.NewInt(1 << 5)
	organizationAPIKeyFieldDisplaySecretKey = big.NewInt(1 << 6)
)

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

func (o *OrganizationAPIKey) GetCreatedAt() time.Time {
	if o == nil {
		return time.Time{}
	}
	return o.CreatedAt
}

func (o *OrganizationAPIKey) GetExpiresAt() *time.Time {
	if o == nil {
		return nil
	}
	return o.ExpiresAt
}

func (o *OrganizationAPIKey) GetLastUsedAt() *time.Time {
	if o == nil {
		return nil
	}
	return o.LastUsedAt
}

func (o *OrganizationAPIKey) GetNote() *string {
	if o == nil {
		return nil
	}
	return o.Note
}

func (o *OrganizationAPIKey) GetPublicKey() string {
	if o == nil {
		return ""
	}
	return o.PublicKey
}

func (o *OrganizationAPIKey) GetDisplaySecretKey() string {
	if o == nil {
		return ""
	}
	return o.DisplaySecretKey
}

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

func (o *OrganizationAPIKey) 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 *OrganizationAPIKey) SetID(id string) {
	o.ID = id
	o.require(organizationAPIKeyFieldID)
}

// 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 (o *OrganizationAPIKey) SetCreatedAt(createdAt time.Time) {
	o.CreatedAt = createdAt
	o.require(organizationAPIKeyFieldCreatedAt)
}

// 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 (o *OrganizationAPIKey) SetExpiresAt(expiresAt *time.Time) {
	o.ExpiresAt = expiresAt
	o.require(organizationAPIKeyFieldExpiresAt)
}

// 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 (o *OrganizationAPIKey) SetLastUsedAt(lastUsedAt *time.Time) {
	o.LastUsedAt = lastUsedAt
	o.require(organizationAPIKeyFieldLastUsedAt)
}

// 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 (o *OrganizationAPIKey) SetNote(note *string) {
	o.Note = note
	o.require(organizationAPIKeyFieldNote)
}

// 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 (o *OrganizationAPIKey) SetPublicKey(publicKey string) {
	o.PublicKey = publicKey
	o.require(organizationAPIKeyFieldPublicKey)
}

// 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 (o *OrganizationAPIKey) SetDisplaySecretKey(displaySecretKey string) {
	o.DisplaySecretKey = displaySecretKey
	o.require(organizationAPIKeyFieldDisplaySecretKey)
}

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

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

func (o *OrganizationAPIKey) 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 (
	organizationAPIKeysResponseFieldAPIKeys = big.NewInt(1 << 0)
)

type OrganizationAPIKeysResponse struct {
	APIKeys []*OrganizationAPIKey `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 (o *OrganizationAPIKeysResponse) GetAPIKeys() []*OrganizationAPIKey {
	if o == nil {
		return nil
	}
	return o.APIKeys
}

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

func (o *OrganizationAPIKeysResponse) require(field *big.Int) {
	if o.explicitFields == nil {
		o.explicitFields = big.NewInt(0)
	}
	o.explicitFields.Or(o.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 (o *OrganizationAPIKeysResponse) SetAPIKeys(apiKeys []*OrganizationAPIKey) {
	o.APIKeys = apiKeys
	o.require(organizationAPIKeysResponseFieldAPIKeys)
}

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

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

func (o *OrganizationAPIKeysResponse) 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 (
	organizationProjectFieldID        = big.NewInt(1 << 0)
	organizationProjectFieldName      = big.NewInt(1 << 1)
	organizationProjectFieldMetadata  = big.NewInt(1 << 2)
	organizationProjectFieldCreatedAt = big.NewInt(1 << 3)
	organizationProjectFieldUpdatedAt = big.NewInt(1 << 4)
)

type OrganizationProject struct {
	ID        string                 `json:"id" url:"id"`
	Name      string                 `json:"name" url:"name"`
	Metadata  map[string]interface{} `json:"metadata,omitempty" url:"metadata,omitempty"`
	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 (o *OrganizationProject) GetID() string {
	if o == nil {
		return ""
	}
	return o.ID
}

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

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

func (o *OrganizationProject) GetCreatedAt() time.Time {
	if o == nil {
		return time.Time{}
	}
	return o.CreatedAt
}

func (o *OrganizationProject) GetUpdatedAt() time.Time {
	if o == nil {
		return time.Time{}
	}
	return o.UpdatedAt
}

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

func (o *OrganizationProject) 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 *OrganizationProject) SetID(id string) {
	o.ID = id
	o.require(organizationProjectFieldID)
}

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

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

// 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 (o *OrganizationProject) SetCreatedAt(createdAt time.Time) {
	o.CreatedAt = createdAt
	o.require(organizationProjectFieldCreatedAt)
}

// 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 (o *OrganizationProject) SetUpdatedAt(updatedAt time.Time) {
	o.UpdatedAt = updatedAt
	o.require(organizationProjectFieldUpdatedAt)
}

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

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

func (o *OrganizationProject) 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 (
	organizationProjectsResponseFieldProjects = big.NewInt(1 << 0)
)

type OrganizationProjectsResponse struct {
	Projects []*OrganizationProject `json:"projects" url:"projects"`

	// 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 *OrganizationProjectsResponse) GetProjects() []*OrganizationProject {
	if o == nil {
		return nil
	}
	return o.Projects
}

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

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

// SetProjects sets the Projects field and marks it as non-optional;
// this prevents an empty or null value for this field from being omitted during serialization.
func (o *OrganizationProjectsResponse) SetProjects(projects []*OrganizationProject) {
	o.Projects = projects
	o.require(organizationProjectsResponseFieldProjects)
}

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

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

func (o *OrganizationProjectsResponse) 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 (
	organizationsUpdateProjectMembershipRequestFieldProjectID = big.NewInt(1 << 0)
)

type OrganizationsUpdateProjectMembershipRequest struct {
	ProjectID string             `json:"-" url:"-"`
	Body      *MembershipRequest `json:"-" url:"-"`

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

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

func (o *OrganizationsUpdateProjectMembershipRequest) UnmarshalJSON(data []byte) error {
	body := new(MembershipRequest)
	if err := json.Unmarshal(data, &body); err != nil {
		return err
	}
	o.Body = body
	return nil
}

func (o *OrganizationsUpdateProjectMembershipRequest) MarshalJSON() ([]byte, error) {
	return json.Marshal(o.Body)
}
