package models

import "time"

type ServeOrder struct {
	ID                    int64     `gorm:"column:id" json:"id"`
	OrgId                 int64     `gorm:"column:org_id" json:"org_id"`
	Period                int64     `gorm:"column:period" json:"period"`
	PeriodStart           int64     `gorm:"column:period_start" json:"period_start"`
	PeriodEnd             int64     `gorm:"column:period_end" json:"period_end"`
	PeriodStartTime       time.Time `gorm:"column:period_start_time" json:"period_start_time"`
	PeriodEndTime         time.Time `gorm:"column:period_end_time" json:"period_end_time"`
	Status                int64     `gorm:"column:status" json:"status"`
	CreatedTime           int64     `gorm:"column:created_time" json:"created_time"`
	UpdatedTime           int64     `gorm:"column:updated_time" json:"updated_time"`
	OrderNumber           string    `gorm:"column:order_number" json:"order_number"`
	OrderStatus           int64     `gorm:"column:order_status" json:"order_status"`
	PayType               int64     `gorm:"column:pay_type" json:"pay_type"`
	PayTime               int64     `gorm:"column:pay_time" json:"pay_time"`
	PaymentAmount         float64   `gorm:"column:payment_amount" json:"payment_amount"`
	PayableAmount         float64   `gorm:"column:payable_amount" json:"payable_amount"`
	DiscountableAmount    float64   `gorm:"column:discountable_amount" json:"discountable_amount"`
	PaymentTransactionId  string    `gorm:"column:payment_transaction_id" json:"payment_transaction_id"`
	ServeName             string    `gorm:"column:serve_name" json:"serve_name"`
	ServeDesc             string    `gorm:"column:serve_desc" json:"serve_desc"`
	ServeDuration         string    `gorm:"column:serve_duration" json:"serve_duration"`
	OrderExpireTime       int64     `gorm:"column:order_expire_time" json:"order_expire_time"`
	Price                 float64   `gorm:"column:price" json:"price"`
	Quantity              int64     `gorm:"column:quantity" json:"quantity"`
	ServeId               int64     `gorm:"column:serve_id" json:"serve_id"`
	OrderExpireTimeFormat string    `gorm:"-"`
}

func (ServeOrder) TableName() string {
	return "sgj_serve_order"
}

type ServeOrderInfomation struct {
	ID          int64   `gorm:"column:id" json:"id"`
	OrgId       int64   `gorm:"column:org_id" json:"org_id"`
	OrderNumber string  `gorm:"column:order_number" json:"order_number"`
	ProductId   int64   `gorm:"column:product_id" json:"product_id"`
	ProductName string  `gorm:"column:product_name" json:"product_name"`
	ProductDesc string  `gorm:"column:product_desc" json:"product_desc"`
	Price       float64 `gorm:"column:price" json:"price"`
	Quantity    int64   `gorm:"column:quantity" json:"quantity"`
	MarketPrice float64 `gorm:"column:market_price" json:"market_price"`
	Status      int64   `gorm:"column:status" json:"status"`
}

func (ServeOrderInfomation) TableName() string {
	return "sgj_serve_order_infomation"
}

type ServeProduct struct {
	ID            int64   `gorm:"column:id" json:"id"`
	ServeName     string  `gorm:"column:serve_name" json:"serve_name"`
	ServeDesc     string  `gorm:"column:serve_desc" json:"serve_desc"`
	OriginalPrice float64 `gorm:"column:original_price" json:"original_price"`
	Price         float64 `gorm:"column:price" json:"price"`
	Status        int64   `gorm:"column:status" json:"status"`
	CreatedTime   int64   `gorm:"column:created_time" json:"created_time"`
	UpdatedTime   int64   `gorm:"column:updated_time" json:"updated_time"`
	ServeDuration int64   `gorm:"column:serve_duration" json:"serve_duration"`
	Edition       int64   `gorm:"column:edition" json:"edition"`
}

func (ServeProduct) TableName() string {
	return "sgj_serve_product"
}

type ServeSubscibe struct {
	ID              int64     `gorm:"column:id" json:"id"`
	OrgId           int64     `gorm:"column:org_id" json:"org_id"`
	PeriodStart     int64     `gorm:"column:period_start" json:"period_start"`
	PeriodEnd       int64     `gorm:"column:period_end" json:"period_end"`
	PeriodStartTime time.Time `gorm:"column:period_start_time" json:"period_start_time"`
	PeriodEndTime   time.Time `gorm:"column:period_end_time" json:"period_end_time"`
	Status          int64     `gorm:"column:status" json:"status"`
	CreatedTime     int64     `gorm:"column:created_time" json:"created_time"`
	UpdatedTime     int64     `gorm:"column:updated_time" json:"updated_time"`
	State           int64     `gorm:"column:state" json:"state" form:"statstateus"`
	Org             Org       `gorm:"ForeignKey:OrgId"`

	Patients int64 `gorm:"-" json:"patients"`
}

func (ServeSubscibe) TableName() string {
	return "sgj_serve_subscibe"
}

type ServeInvoice struct {
	ID                      int64   `gorm:"column:id" json:"id" form:"id"`
	InvoiceType             int64   `gorm:"column:invoice_type" json:"invoice_type" form:"invoice_type"`
	OrgId                   int64   `gorm:"column:org_id" json:"org_id" form:"org_id"`
	InvoiceTitle            string  `gorm:"column:invoice_title" json:"invoice_title" form:"invoice_title"`
	InvoiceAmountGross      float64 `gorm:"column:invoice_amount_gross" json:"invoice_amount_gross" form:"invoice_amount_gross"`
	Recipient               string  `gorm:"column:recipient" json:"recipient" form:"recipient"`
	ContactPhone            string  `gorm:"column:contact_phone" json:"contact_phone" form:"contact_phone"`
	Address                 string  `gorm:"column:address" json:"address" form:"address"`
	TaxIdentificationNumber string  `gorm:"column:tax_identification_number" json:"tax_identification_number" form:"tax_identification_number"`
	Remark                  string  `gorm:"column:remark" json:"remark" form:"remark"`
	Status                  int64   `gorm:"column:status" json:"status" form:"status"`
	CreatedTime             int64   `gorm:"column:created_time" json:"created_time" form:"created_time"`
	UpdatedTime             int64   `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
	Orders                  string  `gorm:"column:orders" json:"orders" form:"orders"`
	InvoiceStatus           int64   `gorm:"column:invoice_status" json:"invoice_status" form:"invoice_status"`
}

func (ServeInvoice) TableName() string {
	return "sgj_serve_invoice"
}

type ServeOrderContract struct {
	ID             int64  `gorm:"column:id" json:"id" form:"id"`
	OrgId          int64  `gorm:"column:org_id" json:"org_id" form:"org_id"`
	OrderId        int64  `gorm:"column:order_id" json:"order_id" form:"order_id"`
	OrderNumber    string `gorm:"column:order_number" json:"order_number" form:"order_number"`
	CompanyTitle   string `gorm:"column:company_title" json:"company_title" form:"company_title"`
	CompanyAddress string `gorm:"column:company_address" json:"company_address" form:"company_address"`
	ContactPhone   string `gorm:"column:contact_phone" json:"contact_phone" form:"contact_phone"`
	Contact        string `gorm:"column:contact" json:"contact" form:"contact"`
	Status         int64  `gorm:"column:status" json:"status" form:"status"`
	CreatedTime    int64  `gorm:"column:created_time" json:"created_time" form:"created_time"`
	UpdatedTime    int64  `gorm:"column:updated_time" json:"updated_time" form:"updated_time"`
}

func (ServeOrderContract) TableName() string {
	return "sgj_serve_order_contract"
}
