package actionlogger

import (
	"time"

	"github.com/fiskerinc/cloud-services/pkg/common/dbbasemodel"
	"github.com/google/uuid"
)

// Use Action Log to track actions taken against a car including remote commands, car updates etc. Mostly worried about car commands for now
type ActionLog struct {
	VIN            string
	UserIdentifier string
	//UserType       string // Not sure how different users can be identified between fisker customers and api admins
	Action         Action // Short Hand of description
	Description    string // JSON string explaining full action
	// TrackingID     *uuid.UUID // If we want to log the same action as it goes through, this tracking ID will follow the same request through
	CallLocation string // Informative field where we created this. Can use runtime reflection if we want, but is more expensive
	dbbasemodel.DBModelBase
}

type Action string

const (
	RemoteCommand Action = "RemoteCommand"
	CarConfigurationUpdate Action = "CarConfigurationUpdate"
	CarUpdate Action = "CarUpdate"
)

type ActionLogFilter struct {
	VINs    []string `pg:",array"`
	Actions []string `pg:",array"`
	Before  time.Time
	After   time.Time
	Limit   int
	TrackingID *uuid.UUID
}
