package handlers

import "time"

var (
	ChapaSecret  string
	ChapaBaseURL string
)

type InitPaymentRequest struct {
	Amount      string `json:"amount"`
	Currency    string `json:"currency"`
	Email       string `json:"email"`
	FirstName   string `json:"first_name"`
	LastName    string `json:"last_name"`
	TxRef       string `json:"tx_ref"`
	CallbackURL string `json:"callback_url"`
	ReturnURL   string `json:"return_url"`
}

type TransferRequest struct {
	AccountNumber string `json:"account_number"`
	BankCode      string `json:"bank_code"`
	Amount        string `json:"amount"`
	Currency      string `json:"currency"`
	Reference     string `json:"reference"`
	Reason        string `json:"reason"`
	RecipientName string `json:"recipient_name"`
}

type ChapaSupportedBank struct {
	Id              int64  `json:"id"`
	Slug            string `json:"slug"`
	Swift           string `json:"swift"`
	Name            string `json:"name"`
	AcctLength      int    `json:"acct_length"`
	AcctNumberRegex string `json:"acct_number_regex"`
	ExampleValue    string `json:"example_value"`
	CountryId       int    `json:"country_id"`
	IsMobilemoney   *int   `json:"is_mobilemoney"`

	IsActive  int       `json:"is_active"`
	IsRtgs    *int      `json:"is_rtgs"`
	Active    int       `json:"active"`
	Is24Hrs   *int      `json:"is_24hrs"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
	Currency  string    `json:"currency"`
}

type ChapaSupportedBanksResponse struct {
	Message string               `json:"message"`
	Data    []ChapaSupportedBank `json:"data"`
}

type InitPaymentData struct {
	TxRef       string `json:"tx_ref"`
	CheckoutURL string `json:"checkout_url"`
}

type InitPaymentResponse struct {
	Status  string          `json:"status"`  // "success"
	Message string          `json:"message"` // e.g., "Payment initialized"
	Data    InitPaymentData `json:"data"`
}

type WebhookPayload map[string]interface{}

type TransactionData struct {
	TxRef         string `json:"tx_ref"`
	Status        string `json:"status"`
	Amount        string `json:"amount"`
	Currency      string `json:"currency"`
	CustomerEmail string `json:"email"`
}

type VerifyTransactionResponse struct {
	Status  string          `json:"status"`
	Message string          `json:"message"`
	Data    TransactionData `json:"data"`
}

type TransferData struct {
	Reference string `json:"reference"`
	Status    string `json:"status"`
	Amount    string `json:"amount"`
	Currency  string `json:"currency"`
}

type CreateTransferResponse struct {
	Status  string       `json:"status"`
	Message string       `json:"message"`
	Data    TransferData `json:"data"`
}

type TransferVerificationData struct {
	Reference   string `json:"reference"`
	Status      string `json:"status"`
	BankCode    string `json:"bank_code"`
	AccountName string `json:"account_name"`
}

type VerifyTransferResponse struct {
	Status  string                   `json:"status"`
	Message string                   `json:"message"`
	Data    TransferVerificationData `json:"data"`
}
