package impl

import (
	"errors"
	"fmt"
	"time"

	"github.com/pingcap/dbaas/billing2/billing_errors"
	"github.com/pingcap/dbaas/billing2/config"
	"github.com/pingcap/dbaas/billing2/db/entity"
	"github.com/pingcap/dbaas/billing2/forms"
	"github.com/pingcap/dbaas/billing2/handler/paymenthandler"
)

type WireTransferHandlerImpl struct {
}

func (*WireTransferHandlerImpl) Setup(tenant *forms.Tenant) (string, error) {
	return fmt.Sprint(tenant.TenantID), nil
}

func (*WireTransferHandlerImpl) Pay(paymentInfo *forms.PaymentMethod, billingCompany *forms.BillingCompany, invoice *forms.Invoice) (*forms.Invoice, error) {
	return invoice, nil
}

func (*WireTransferHandlerImpl) PayMultiInvoice(paymentInfo *forms.PaymentMethod, billingCompany *forms.BillingCompany, invoices []forms.Invoice) ([]forms.Invoice, error) {
	return invoices, nil
}

func (*WireTransferHandlerImpl) Payable(tenantID uint, userCode string) (bool, error) {
	return true, nil
}

func (*WireTransferHandlerImpl) NeedMultiInvoiceSendOnce() bool {
	return false
}

func (h *WireTransferHandlerImpl) GetThirdPartyName() string {
	return entity.PaymentType_WireTransfer
}

func (h *WireTransferHandlerImpl) EnableReconciliation() bool {
	return false
}

func (h *WireTransferHandlerImpl) GetDailyRevenue(date time.Time) ([]*paymenthandler.TenantRevenue, error) {
	return nil, billing_errors.NewNotImplementedError(errors.New("don't need"))
}

func (h *WireTransferHandlerImpl) GetMonthlyRevenue(date time.Time) ([]*paymenthandler.TenantRevenue, error) {
	return nil, billing_errors.NewNotImplementedError(errors.New("don't need"))
}

func (h *WireTransferHandlerImpl) EnableTaxCalculation() bool {
	return config.Get().GetBool(config.EnableTaxCalculation)
}

func (h *WireTransferHandlerImpl) EnableHourlySending(tenantID, billingConfigID uint) bool {
	return false
}

func (h *WireTransferHandlerImpl) EnableDailySending(tenantID, billingConfigID uint) (bool, int) {
	return false, 0
}

func (h *WireTransferHandlerImpl) NeedInMonthInvoice() bool {
	return false
}

func (h *WireTransferHandlerImpl) NeedSetInvoiceAutoConfirm() bool {
	return false
}
