package storable

import (
	"time"

	"go.mongodb.org/mongo-driver/v2/bson"
)

const (
	IDField              = "_id"
	PermissionRefField   = "permissionRef"
	OrganizationRefField = "organizationRef"
	IsArchivedField      = "isArchived"
	UpdatedAtField       = "updatedAt"
)

type Base struct {
	ID        bson.ObjectID `bson:"_id" json:"id"`
	CreatedAt time.Time     `bson:"createdAt" json:"createdAt"` // Timestamp for when the comment was created
	UpdatedAt time.Time     `bson:"updatedAt" json:"updatedAt"` // Timestamp for when the comment was last updated (optional)
}

func (b *Base) GetID() *bson.ObjectID {
	return &b.ID
}

func (b *Base) SetID(objID bson.ObjectID) {
	b.ID = objID
	b.CreatedAt = time.Now()
	b.UpdatedAt = time.Now()
}

func (b *Base) Update() {
	b.UpdatedAt = time.Now()
}

func (b *Base) Collection() string {
	return "base"
}
