package dns

import "context"

// Record represents a DNS record from a provider.
type Record struct {
	ID      string `json:"id"`
	FQDN    string `json:"fqdn"`
	Type    string `json:"type"`
	Content string `json:"content"` // IP address for A records
	TTL     int    `json:"ttl"`
	Proxied bool   `json:"proxied"`
}

// Zone represents a DNS zone from a provider.
type Zone struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

// Provider is the interface for DNS record management.
type Provider interface {
	// EnsureRecord creates an A record if it doesn't exist, or updates it if the IP differs.
	EnsureRecord(ctx context.Context, fqdn, ip string) (recordID string, err error)

	// DeleteRecord removes an A record by FQDN. No error if it doesn't exist.
	DeleteRecord(ctx context.Context, fqdn string) error

	// ListRecords returns all A records in the zone.
	ListRecords(ctx context.Context) ([]Record, error)

	// TestConnection verifies that the provider credentials are valid.
	TestConnection(ctx context.Context) error
}
