package types

import "time"

// Chain represents a blockchain type
type Chain string

const (
	ChainBitcoin  Chain = "bitcoin"
	ChainEthereum Chain = "ethereum"
)

// AddressInfo contains information about a derived address
type AddressInfo struct {
	Address  string
	Path     string
	Balance  uint64
	TxCount  int
	Chain    Chain
	Received uint64
	Sent     uint64
}

// Transaction represents a blockchain transaction
type Transaction struct {
	TxID        string
	Time        time.Time
	BlockHeight int
	Confirmed   bool
	Received    uint64
	Sent        uint64
	Fee         uint64
	NetChange   int64 // Can be negative
	Addresses   []string
}

// TransactionDetail provides detailed transaction information
type TransactionDetail struct {
	TxID        string
	Time        time.Time
	BlockHeight int
	Confirmed   bool
	Type        string // "received", "sent", "self"
	Amount      uint64
	Balance     uint64 // Running balance after this tx
	Address     string
}

// WalletSummary contains overall wallet statistics
type WalletSummary struct {
	TotalBalance      uint64
	TotalReceived     uint64
	TotalSent         uint64
	TotalTxCount      int
	ReceiveTxCount    int
	SendTxCount       int
	ActiveAddresses   []AddressInfo
	TransactionHistory []TransactionDetail
}

// ChainAnalyzer defines the interface for blockchain analysis
type ChainAnalyzer interface {
	DeriveAddresses(seed []byte, count int) ([]AddressInfo, error)
	GetAddressInfo(address string) (balance, txCount uint64, received, sent uint64, err error)
	GetTransactions(address string) ([]Transaction, error)
	GetChain() Chain
}
