package request

import (
	"ffie-admin/server/model/brc"
	"ffie-admin/server/model/common/request"
	"time"
)

type BrcLockSearch struct {
	brc.BrcLock
	StartCreatedAt *time.Time `json:"startCreatedAt" form:"startCreatedAt"`
	EndCreatedAt   *time.Time `json:"endCreatedAt" form:"endCreatedAt"`
	request.PageInfo
}

type CreateBrx20TxReq struct {
	InscriptionId string `json:"inscriptionId" form:"inscriptionId" gorm:"column:inscription_id;comment:;size:72;"`
	Sender        string `json:"sender" form:"sender" gorm:"column:sender;comment:;size:72;"`
	Receiver      string `json:"receiver" form:"receiver" gorm:"column:receiver;comment:;size:72;"`
	Ticker        string `json:"ticker" form:"ticker" gorm:"column:token;size:4;"`
	Amount        int    `json:"amount" form:"amount" gorm:"column:amount;comment:;size:19;"`
	FeeRate       int    `json:"feeRate" form:"feeRate" gorm:"column:fee_rate;comment:;size:19;"`
	UtxoHash      string `json:"utxoHash" form:"utxoHash" gorm:"column:utxo_hash;comment:;size:72;"`
	UtxoIndex     int    `json:"utxoIndex" form:"utxoIndex" gorm:"column:utxo_index;comment:;size:19;"`
}

// 前端请求参数结构
type InscriptionTransferRequest struct {
	FromAddress string   `json:"fromAddress"`
	ToAddress   string   `json:"toAddress"`
	Ticker      string   `json:"ticker"`  // 代币符号FFFF
	Amount      uint64   `json:"amount"`  // 转移数量
	FeeRate     uint64   `json:"feeRate"` // sat/byte
	UTXOs       []string `json:"utxos"`   // 铭文UTXO的txid:vout
}

type PSBTResponse struct {
	UnsignedPSBT string   `json:"unsignedPSBT"`
	UsedUTXOs    []string `json:"usedUTXOs"`
	ChangeAmount int64    `json:"changeAmount"` // 找零金额
}

type InscriptionUTXO struct {
	TxID   string `json:"txid"`   // 交易哈希
	Vout   uint32 `json:"vout"`   // 输出索引
	Amount uint64 `json:"amount"` // 代币数量
	BTCAmt int64  `json:"btcAmt"` // 比特币金额（546聪）
	Script string `json:"script"` // 铭文脚本
}
