package subscribedomain

import (
	subscribeplandm "legalgo-BE-go/internal/domain/subscribe_plan_model"
	"time"
)

type SubscribeDepecrate struct {
	ID              string `json:"id"`
	SubscribePlanID string `json:"subscribe_plan_id"`
}

type SubscribeUpdateReqDepecrate struct {
	ID     string `json:"id"`
	Status string `json:"status"`
}

// refactored
type Subscribe struct {
	ID              string    `gorm:"primaryKey" json:"id"`
	SubscribePlanID string    `gorm:"not null" json:"subscribe_plan_id"`
	StartDate       time.Time `gorm:"default:CURRENT_TIMESTAMP"`
	EndDate         time.Time `gorm:"default:null"`
	Status          string    `gorm:"default:'inactive'"`
	AutoRenew       bool      `gorm:"default:true"`

	SubscribePlan subscribeplandm.SubscribePlan `gorm:"foreignKey:SubscribePlanID;constraint:OnDelete:CASCADE" json:"subscribe_plan"`
}
