package models

import "time"

type OrderPayment struct {
	ID uint `gorm:"primaryKey;autoIncrement" json:"id"`
	OrderID uint `gorm:"column:orderId;not null;index" json:"orderId"`
	GrossAmount int `gorm:"column:grossAmount;not null" json:"grossAmount"`
	GSTPercent float64 `gorm:"column:gstPercent;type:double;not null" json:"gstPercent"`
	GSTAmount float64 `gorm:"column:gstAmount;type:double;not null" json:"gstAmount"`
	DiscountAmount float64 `gorm:"column:discountAmount;type:double;not null" json:"discountAmount"`
	WalletBalanceDeducted float64 `gorm:"column:walletBalanceDeducted;type:double;not null" json:"walletBalanceDeducted"`
	NetAmount float64 `gorm:"column:netAmount;type:double;not null" json:"netAmount"`
	AstrologerID uint `gorm:"column:astrologerId;not null;index" json:"astrologerId"`
	PaymentMethod string `gorm:"column:paymentMethod;type:varchar(255);not null" json:"paymentMethod"`
	AstrologerPayment int `gorm:"column:astrologerPayment;not null" json:"astrologerPayment"`
	IsActive bool `gorm:"column:isActive;default:true" json:"isActive"`
	IsDelete bool `gorm:"column:isDelete;default:false" json:"isDelete"`
	CreatedAt *time.Time `gorm:"column:created_at" json:"created_at"`
	UpdatedAt *time.Time `gorm:"column:updated_at" json:"updated_at"`
	CreatedBy int `gorm:"column:createdBy;not null" json:"createdBy"`
	ModifiedBy int `gorm:"column:modifiedBy;not null" json:"modifiedBy"`
	// Relations
	Order UserOrder `gorm:"foreignKey:OrderID;references:ID" json:"order"`
	Astrologer User `gorm:"foreignKey:AstrologerID;references:ID" json:"astrologer"`
}

func (OrderPayment) TableName() string {
	return "order_payments"
}