package usecase

import (
	"context"

	"haixun-backend/internal/model/content_formula/domain/entity"
)

type FormulaSummary struct {
	ID              string
	AccountID       string
	Label           string
	SourceType      string
	SourceRef       string
	SourcePostText  string
	SourceAuthor    string
	SourcePermalink string
	SourceMetrics   *entity.SourceMetrics
	Summary         string
	Wins            []string
	Improvements    []string
	Formula         string
	PostTemplate    string
	HookPattern     string
	Structure       string
	ReplicationTips []string
	Avoid           []string
	Tags            []string
	CreateAt        int64
	UpdateAt        int64
}

type CreateRequest struct {
	TenantID        string
	OwnerUID        string
	AccountID       string
	Label           string
	SourceType      string
	SourceRef       string
	SourcePostText  string
	SourceAuthor    string
	SourcePermalink string
	SourceMetrics   *entity.SourceMetrics
	Summary         string
	Wins            []string
	Improvements    []string
	Formula         string
	PostTemplate    string
	HookPattern     string
	Structure       string
	ReplicationTips []string
	Avoid           []string
	Tags            []string
}

type UpdateRequest struct {
	TenantID     string
	OwnerUID     string
	AccountID    string
	FormulaID    string
	Label        *string
	Formula      *string
	PostTemplate *string
	HookPattern  *string
	Structure    *string
	Tags         []string
}

type ListRequest struct {
	TenantID   string
	OwnerUID   string
	AccountID  string
	SourceType string
	Tag        string
	Page       int
	PageSize   int
}

type ListResult struct {
	Items []FormulaSummary
	Total int64
}

type UseCase interface {
	Create(ctx context.Context, req CreateRequest) (*FormulaSummary, error)
	Get(ctx context.Context, tenantID, ownerUID, accountID, formulaID string) (*FormulaSummary, error)
	Update(ctx context.Context, req UpdateRequest) (*FormulaSummary, error)
	Delete(ctx context.Context, tenantID, ownerUID, accountID, formulaID string) error
	List(ctx context.Context, req ListRequest) (*ListResult, error)
}
