package apple

import "time"

type Transaction struct {
	Id                   int64      `gorm:"primaryKey"`
	UserId               int64      `gorm:"index:idx_user_id;not null;comment:User ID"`
	OriginalTransactionId string     `gorm:"type:varchar(255);uniqueIndex:uni_original;not null;comment:Original Transaction ID"`
	TransactionId        string     `gorm:"type:varchar(255);not null;comment:Transaction ID"`
	ProductId            string     `gorm:"type:varchar(255);not null;comment:Product ID"`
	PurchaseAt           time.Time  `gorm:"not null;comment:Purchase Time"`
	RevocationAt         *time.Time `gorm:"comment:Revocation Time"`
	JWSHash              string     `gorm:"type:varchar(255);not null;comment:JWS Hash"`
	CreatedAt            time.Time  `gorm:"<-:create;comment:Create Time"`
	UpdatedAt            time.Time  `gorm:"comment:Update Time"`
}

func (Transaction) TableName() string {
	return "apple_iap_transactions"
}

