package config import ( "time" "gorm.io/gorm" ) type Certificate struct { ID uint `gorm:"primarykey" json:"id"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` DeletedAt gorm.DeletedAt `gorm:"index" json:"deleted_at,omitempty"` Domain string `json:"domain" gorm:"uniqueIndex;size:255"` Email string `json:"email" gorm:"size:255"` Provider string `json:"provider" gorm:"size:50;default:letsencrypt"` // letsencrypt, zerossl ChallengeType string `json:"challenge_type" gorm:"size:20;default:http"` // http, dns DNSProvider string `json:"dns_provider,omitempty" gorm:"size:50"` // alidns, cloudflare, etc. DNSConfig string `json:"dns_config,omitempty" gorm:"type:text"` // JSON config for DNS provider Status string `json:"status" gorm:"size:20;default:pending"` // pending, active, expired, error CertURL string `json:"cert_url,omitempty" gorm:"size:512"` ExpiresAt *time.Time `json:"expires_at,omitempty"` LastRenewedAt *time.Time `json:"last_renewed_at,omitempty"` ErrorMessage string `json:"error_message,omitempty" gorm:"type:text"` // Auto renew settings AutoRenew bool `json:"auto_renew" gorm:"default:true"` RenewDays int `json:"renew_days" gorm:"default:30"` // Renew when expires within this many days // ACME account key AccountKeyID uint `json:"account_key_id,omitempty"` }