package client

import "time"

// Issue represents a generic issue that any downstream system (Jira, Lark, ServiceNow) can understand
type Issue struct {
	ID             string
	Key            string
	Summary        string
	Description    string
	Project        string
	IssueType      string
	Labels         []string
	Priority       string
	Components     []string
	ParentKey      string
	ResolutionDate time.Time
	CreatedDate    time.Time
	Status         string
	StatusCategory string // Jira status category key: "new", "indeterminate", "done"
	Resolution     string
	CustomFields   map[string]interface{} // For Jira customfield_xxx or other system's specific fields
	Raw            interface{}            // Original client response payload
}

// SearchOptions is generic options for querying tickets
type SearchOptions struct {
	MaxResults int
	SortBy     string
}

// IssueTracker is a truly abstract interface for any downstream tracking system.
type IssueTracker interface {
	Search(query string, options *SearchOptions) ([]*Issue, bool, error)
	Create(issue *Issue) (*Issue, bool, error)
	UpdateSummary(issueKey string, summary string) (bool, error)
	UpdateDescription(issueKey string, description string) (bool, error)
	AddComment(issueKey string, body string) (bool, error)
	AutoRecover(issueKey string, recoveredMsg string) (bool, error)
}
