package workspace

import (
	"cloud.o-forge.io/core/oc-lib/models/utils"
	"cloud.o-forge.io/core/oc-lib/tools"
	"github.com/google/uuid"
)

type WorkspaceHistory struct{ Workspace }

func (d *WorkspaceHistory) GetAccessor(caller *tools.HTTPCaller) utils.Accessor {
	data := New()                              // Create a new instance of the accessor
	data.Init(tools.WORKSPACE_HISTORY, caller) // Initialize the accessor with the WORKSPACE model type
	return data
}
func (r *WorkspaceHistory) GenerateID() {
	r.UUID = uuid.New().String()
}

// Workspace is a struct that represents a workspace
type workspaceHistoryMongoAccessor struct {
	workspaceMongoAccessor // AbstractAccessor contains the basic fields of an accessor (model, caller)
}

// New creates a new instance of the workspaceMongoAccessor
func NewHistory() *workspaceHistoryMongoAccessor {
	return &workspaceHistoryMongoAccessor{}
}

func (r *workspaceHistoryMongoAccessor) MapFromWorkspace(w *Workspace) *WorkspaceHistory {
	wh := &WorkspaceHistory{Workspace: *w}
	wh.GenerateID()
	return wh
}
