package service

import (
	"context"
	_ "fmt"
	"git.gocasts.ir/ebhomengo/niki/domain/campaign/entity"
	"git.gocasts.ir/ebhomengo/niki/types"
)

type CampaignFilterParam struct {
	AdminID types.ID
	Status  string
	//nil true false
	IsArchived *bool
}

type CampaignStorage interface {
	Create(ctx context.Context, c entity.Campaign) (types.ID, error) // باید ID برگرداند
	Update(ctx context.Context, c entity.Campaign) error
	FindByID(ctx context.Context, id types.ID) (entity.Campaign, error)
	FindAll(ctx context.Context, filter CampaignFilterParam) ([]entity.Campaign, error)
	Archive(ctx context.Context, id types.ID) error // instead Delete
	TotalDonations(ctx context.Context, campaignID types.ID) (int64, error)
}

type CampaignService struct {
	repo CampaignStorage
}

// NewCampaignService constructs a new CampaignService.
func NewCampaignService(storage CampaignStorage) *CampaignService {
	return &CampaignService{
		repo: storage,
	}
}
