diff --git a/backend/internal/domain/discovery/model.go b/backend/internal/domain/discovery/model.go new file mode 100644 index 0000000..df4809a --- /dev/null +++ b/backend/internal/domain/discovery/model.go @@ -0,0 +1,86 @@ +// backend/internal/domain/discovery/model.go +package discovery + +import ( + "time" + + "github.com/google/uuid" +) + +// Bucket is a scheduler row: one (land, region, year_month) tuple. +type Bucket struct { + ID uuid.UUID + Land string + Region string + YearMonth string // 'YYYY-MM' + LastQueriedAt *time.Time + LastError string + CreatedAt time.Time +} + +// DiscoveredMarket is a queue entry awaiting admin review. +type DiscoveredMarket struct { + ID uuid.UUID + BucketID uuid.UUID + MarktName string + Stadt string + Bundesland string + Land string + StartDatum *time.Time + EndDatum *time.Time + Website string + Quellen []string + Extraktion string + Hinweis string + NameNormalized string + MatchedSeriesID *uuid.UUID + Status string // 'pending' | 'accepted' | 'rejected' + DiscoveredAt time.Time + ReviewedAt *time.Time + ReviewedBy *uuid.UUID + CreatedEditionID *uuid.UUID +} + +// RejectedDiscovery stores a sticky rejection scoped to (normalized_name, city, year). +type RejectedDiscovery struct { + ID uuid.UUID + NameNormalized string + Stadt string + Year int + RejectedAt time.Time + RejectedBy *uuid.UUID + Reason string +} + +// Pass0Response is the parsed shape of the Mistral Pass 0 agent reply. +type Pass0Response struct { + Bucket Pass0Bucket `json:"bucket"` + RechercheDatum string `json:"recherche_datum"` + QuellenGesamt []string `json:"quellen_gesamt"` + Maerkte []Pass0Market `json:"maerkte"` +} + +type Pass0Bucket struct { + Land string `json:"land"` + Region string `json:"region"` + JahrMonat string `json:"jahr_monat"` +} + +type Pass0Market struct { + MarktName string `json:"markt_name"` + Stadt string `json:"stadt"` + Bundesland string `json:"bundesland"` + StartDatum string `json:"start_datum"` // 'YYYY-MM-DD' or "" + EndDatum string `json:"end_datum"` + Website string `json:"website"` + Quellen []string `json:"quellen"` + Extraktion string `json:"extraktion"` + Hinweis string `json:"hinweis"` +} + +// Status constants for discovered_markets. +const ( + StatusPending = "pending" + StatusAccepted = "accepted" + StatusRejected = "rejected" +)