package domain

type CheckoutSessionRequest struct {
	CancelURL      string   `json:"cancelUrl"`
	Phone          string   `json:"phone"`
	Email          string   `json:"email"`
	Nonce          string   `json:"nonce"`
	SuccessURL     string   `json:"successUrl"`
	ErrorURL       string   `json:"errorUrl"`
	NotifyURL      string   `json:"notifyUrl"`
	PaymentMethods []string `json:"paymentMethods"`
	ExpireDate     string   `json:"expireDate"` // could also use time.Time if you parse it

	Items []struct {
		Name        string  `json:"name"`
		Quantity    int     `json:"quantity"`
		Price       float64 `json:"price"`
		Description string  `json:"description"`
	} `json:"items"`

	Beneficiaries []struct {
		AccountNumber string  `json:"accountNumber"`
		Bank          string  `json:"bank"`
		Amount        float64 `json:"amount"`
	} `json:"beneficiaries"`

	Lang string `json:"lang"`
}

type CheckoutSessionClientRequest struct {
	Amount        float64 `json:"amount" binding:"required"`
	CustomerEmail string  `json:"customerEmail" binding:"required"`
	CustomerPhone string  `json:"customerPhone" binding:"required"`
}

type CancelCheckoutSessionResponse struct {
	Error bool   `json:"error"`
	Msg   string `json:"msg"`
	Data  struct {
		SessionID   string  `json:"sessionId"`
		PaymentURL  string  `json:"paymentUrl"`
		CancelURL   string  `json:"cancelUrl"`
		TotalAmount float64 `json:"totalAmount"`
	} `json:"data"`
}

type WebhookRequest struct {
	UUID              string `json:"uuid"`
	Nonce             string `json:"nonce"`
	Phone             string `json:"phone"`
	PaymentMethod     string `json:"paymentMethod"`
	TotalAmount       int64  `json:"totalAmount"`
	TransactionStatus string `json:"transactionStatus"`
	Transaction       struct {
		TransactionID     string `json:"transactionId"`
		TransactionStatus string `json:"transactionStatus"`
	} `json:"transaction"`
	NotificationURL string `json:"notificationUrl"`
	SessionID       string `json:"sessionId"`
}

// type ArifpayB2CRequest struct{
// 	PhoneNumber string `json:"Phonenumber"`
// 	Amount        float64 `json:"amount" binding:"required"`
// 	CustomerEmail string  `json:"customerEmail" binding:"required"`
// 	// CustomerPhone string  `json:"customerPhone" binding:"required"`
// }

type ArifpayVerifyByTransactionIDRequest struct {
	TransactionId string `json:"transactionId"`
	PaymentType   int    `json:"paymentType"`
}

type ARIFPAYPaymentMethod struct {
	ID   int
	Name string
}

// Direct Payment Types
type DirectPaymentMethod string

const (
	DirectPaymentTelebirr     DirectPaymentMethod = "TELEBIRR"
	DirectPaymentTelebirrUSSD DirectPaymentMethod = "TELEBIRR_USSD"
	DirectPaymentCBE          DirectPaymentMethod = "CBE"
	DirectPaymentAmole        DirectPaymentMethod = "AMOLE"
	DirectPaymentHelloCash    DirectPaymentMethod = "HELLOCASH"
	DirectPaymentAwash        DirectPaymentMethod = "AWASH"
	DirectPaymentMPesa        DirectPaymentMethod = "MPESA"
)

type InitiateDirectPaymentRequest struct {
	PlanID        int64               `json:"plan_id" validate:"required"`
	Phone         string              `json:"phone" validate:"required"`
	Email         string              `json:"email" validate:"required,email"`
	PaymentMethod DirectPaymentMethod `json:"payment_method" validate:"required"`
}

type InitiateDirectPaymentResponse struct {
	PaymentID   int64   `json:"payment_id"`
	SessionID   string  `json:"session_id"`
	RequiresOTP bool    `json:"requires_otp"`
	Message     string  `json:"message"`
	Amount      float64 `json:"amount"`
	Currency    string  `json:"currency"`
}

type VerifyOTPRequest struct {
	SessionID string `json:"session_id" validate:"required"`
	OTP       string `json:"otp" validate:"required"`
}

type VerifyOTPResponse struct {
	Success       bool   `json:"success"`
	Message       string `json:"message"`
	TransactionID string `json:"transaction_id,omitempty"`
	PaymentID     int64  `json:"payment_id,omitempty"`
}
