package workflow

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

type WorkflowHistory struct{ Workflow }

func (d *WorkflowHistory) 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 *WorkflowHistory) GenerateID() {
	r.UUID = uuid.New().String()
}

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

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

func (r *workflowHistoryMongoAccessor) MapFromWorkflow(w *Workflow) *WorkflowHistory {
	wh := &WorkflowHistory{Workflow: *w}
	wh.GenerateID()
	return wh
}
