package dashboard

// SummaryResponse powers hero pills and stat cards.
type SummaryResponse struct {
	TotalTenders        int64   `json:"total_tenders"`
	ActiveTenders       int64   `json:"active_tenders"`
	AwardedTenders      int64   `json:"awarded_tenders"`
	ExpiredTenders      int64   `json:"expired_tenders"`
	CancelledTenders    int64   `json:"cancelled_tenders"`
	ClosingSoon         int64   `json:"closing_soon"`
	TotalEstimatedValue float64 `json:"total_estimated_value"`
	ValueCurrency       string  `json:"value_currency"`
	GeneratedAt         int64   `json:"generated_at"`
}

// TrendResponse powers the tender flow chart.
type TrendResponse struct {
	Metric string       `json:"metric"`
	Days   int          `json:"days"`
	Series []TrendPoint `json:"series"`
}

// TrendPoint is a single day in the trend series.
type TrendPoint struct {
	Date  string `json:"date"`
	Count int64  `json:"count"`
}

// CountriesResponse powers the country distribution widget.
type CountriesResponse struct {
	Total       int64         `json:"total"`
	Items       []CountryItem `json:"items"`
	OtherCount  int64         `json:"other_count"`
}

// CountryItem is a country bucket in the distribution.
type CountryItem struct {
	CountryCode string `json:"country_code"`
	Count       int64  `json:"count"`
}

// NoticeTypesResponse powers the notice type mix widget.
type NoticeTypesResponse struct {
	Total int64            `json:"total"`
	Items []NoticeTypeItem `json:"items"`
}

// NoticeTypeItem is a notice type bucket.
type NoticeTypeItem struct {
	Type  string `json:"type"`
	Count int64  `json:"count"`
}

// ClosingSoonResponse powers the closing soon card.
type ClosingSoonResponse struct {
	Items []ClosingSoonItem `json:"items"`
}

// ClosingSoonItem is a tender closing within the configured window.
type ClosingSoonItem struct {
	ID                  string  `json:"id"`
	Title               string  `json:"title"`
	CountryCode         string  `json:"country_code"`
	BuyerName           string  `json:"buyer_name"`
	SubmissionDeadline  int64   `json:"submission_deadline"`
	TenderDeadline      int64   `json:"tender_deadline"`
	Status              string  `json:"status"`
	EstimatedValue      float64 `json:"estimated_value"`
	Currency            string  `json:"currency"`
}

// RecentResponse powers the recent tenders feed.
type RecentResponse struct {
	Items      []RecentItem `json:"items"`
	NextCursor *string      `json:"next_cursor"`
}

// RecentItem is a row in the recent tenders list.
type RecentItem struct {
	ID              string `json:"id"`
	Title           string `json:"title"`
	CountryCode     string `json:"country_code"`
	Status          string `json:"status"`
	BuyerName       string `json:"buyer_name"`
	CreatedAt       int64  `json:"created_at"`
	PublicationDate int64  `json:"publication_date"`
}
