package models

import (
	"encoding/json"
	"time"
)

// AutoDeploySettings contains auto-deployment configuration
type AutoDeploySettings struct {
	Enabled               bool              `json:"enabled"`
	DefaultProviderID     string            `json:"default_provider_id"`
	DefaultTemplateID     string            `json:"default_template_id"`
	DefaultRegion         string            `json:"default_region"`
	AutoDeployNewClients  bool              `json:"auto_deploy_new_clients"`
	WebhookSecret         string            `json:"webhook_secret,omitempty"`
	WebhookURL            string            `json:"webhook_url"`
	DefaultTags           map[string]string `json:"default_tags"`
	ResourceLimits        ResourceLimits    `json:"resource_limits"`
	NotificationEndpoints []string          `json:"notification_endpoints"`
}

// ResourceLimits defines resource constraints for auto-deployments
type ResourceLimits struct {
	MaxCPUCores int `json:"max_cpu_cores"`
	MaxMemoryGB int `json:"max_memory_gb"`
	MaxDiskGB   int `json:"max_disk_gb"`
	MaxCount    int `json:"max_count"` // Maximum number of instances
}

// AutoDeployRequest represents a request to automatically deploy for a client
type AutoDeployRequest struct {
	ClientID   string            `json:"client_id"`
	TemplateID string            `json:"template_id,omitempty"`
	ProviderID string            `json:"provider_id,omitempty"`
	Region     string            `json:"region,omitempty"`
	Tags       map[string]string `json:"tags,omitempty"`
	Priority   string            `json:"priority,omitempty"` // Low, Medium, High
}

// WebhookPayload represents data sent to or received from a webhook
type WebhookPayload struct {
	Event      string          `json:"event"`
	Timestamp  time.Time       `json:"timestamp"`
	ClientID   string          `json:"client_id"`
	Data       json.RawMessage `json:"data"`
	Signature  string          `json:"signature,omitempty"`
	RequestID  string          `json:"request_id"`
	ProviderID string          `json:"provider_id,omitempty"`
}
