package dashboard

import (
	"time"

	"github.com/nexuscrm/shared/pkg/models"
)

// Definition is the Salesforce-compatible Dashboard metadata payload owned by
// the CRM dialect.
type Definition struct {
	ID            string                `json:"id"`
	Name          string                `json:"name"`
	DeveloperName string                `json:"developerName"`
	Description   string                `json:"description"`
	LayoutType    string                `json:"layoutType"`
	DashboardType string                `json:"dashboardType,omitempty"`
	RunningUserId string                `json:"runningUserId,omitempty"`
	Components    []ComponentDefinition `json:"components"`
}

type ComponentDefinition struct {
	ID       string                 `json:"id"`
	ReportID string                 `json:"reportId"`
	Type     string                 `json:"type"`
	Title    string                 `json:"title"`
	Config   map[string]interface{} `json:"config"`
}

// Result is the Salesforce-compatible Dashboard execution payload owned by
// the CRM dialect.
type Result struct {
	DashboardMetadata Definition                      `json:"dashboardMetadata"`
	ComponentData     map[string]*models.ReportResult `json:"componentData"`
	GeneratedAt       time.Time                       `json:"generatedAt"`
}
