package httpinvoce

import (
	"io"
	"log/slog"
	"time"

	"git.schreifuchs.ch/lou-taylor/accounting/internal/email"
	"git.schreifuchs.ch/lou-taylor/accounting/pkg/invoice"
	"git.schreifuchs.ch/lou-taylor/accounting/pkg/invoice/model"
	"git.schreifuchs.ch/lou-taylor/accounting/pkg/invoice/report"
)

type Service struct {
	log     *slog.Logger
	invoice invoicer
	mail    mailer
}

func New(log *slog.Logger, invoice invoicer, mail mailer) *Service {
	return &Service{log: log, invoice: invoice, mail: mail}
}

type invoicer interface {
	Generate(creditor model.Entity, deptor *model.Entity, mindur time.Duration, rate float64, repos []invoice.Repo) (document io.ReadCloser, report *report.Report, err error)
}

type mailer interface {
	Send(m email.Mail) (err error)
}
