125 lines
7.4 KiB
Go
125 lines
7.4 KiB
Go
package models
|
|
|
|
type PostalZone struct {
|
|
Name string `json:"name"`
|
|
MinAmount float64 `json:"min_amount"`
|
|
Codes []string `json:"codes"`
|
|
}
|
|
|
|
// PointsTier représente un palier du barème de points
|
|
// Si Max == 0, il n'y a pas de borne supérieure (illimité)
|
|
type PointsTier struct {
|
|
Min float64 `json:"min"`
|
|
Max float64 `json:"max"` // 0 = illimité
|
|
Points int `json:"points"`
|
|
}
|
|
|
|
// RewardCategoryConfig définit les produits éligibles dans une catégorie pour une récompense
|
|
type RewardCategoryConfig struct {
|
|
Category string `json:"category"` // nom de la catégorie
|
|
AllProducts bool `json:"all_products"` // true = tous les produits de la catégorie
|
|
ProductIDs []int `json:"product_ids"` // IDs des produits éligibles si AllProducts = false
|
|
}
|
|
|
|
// RewardItem représente un produit offert lors d'une récompense, avec sa quantité et son prix associé
|
|
type RewardItem struct {
|
|
ProductID int `json:"product_id"` // ID du produit ajouté au panier
|
|
Quantity float64 `json:"quantity"` // quantité offerte
|
|
Price float64 `json:"price"` // valeur indicative affichée au client
|
|
}
|
|
|
|
// PointsReward représente la récompense débloquée à partir d'un seuil de points cumulés
|
|
type PointsReward struct {
|
|
Threshold int `json:"threshold"` // points cumulés nécessaires (ex: 20)
|
|
Type string `json:"type"` // "free_product" | "half_price_product" | "custom"
|
|
Description string `json:"description"` // description libre affichée au client
|
|
CategoryConfigs []RewardCategoryConfig `json:"category_configs"` // catégories + produits éligibles
|
|
RewardItems []RewardItem `json:"reward_items"` // produits ajoutés au panier lors du claim
|
|
}
|
|
|
|
// DaySchedule représente les horaires de livraison pour un jour de la semaine
|
|
type DaySchedule struct {
|
|
Enabled bool `json:"enabled"`
|
|
OpenTime string `json:"open_time"` // ex: "09:00"
|
|
CloseTime string `json:"close_time"` // ex: "20:00"
|
|
}
|
|
|
|
// DeliverySchedule représente les horaires de livraison pour chaque jour
|
|
type DeliverySchedule struct {
|
|
Monday DaySchedule `json:"monday"`
|
|
Tuesday DaySchedule `json:"tuesday"`
|
|
Wednesday DaySchedule `json:"wednesday"`
|
|
Thursday DaySchedule `json:"thursday"`
|
|
Friday DaySchedule `json:"friday"`
|
|
Saturday DaySchedule `json:"saturday"`
|
|
Sunday DaySchedule `json:"sunday"`
|
|
}
|
|
|
|
type PointsPool struct {
|
|
Key string `json:"key"` // identifiant interne (ex: "pool_0")
|
|
Name string `json:"name"` // nom affiché (ex: "Cannabis", "Accessoires")
|
|
Categories []string `json:"categories"` // catégories de produits assignées à ce pool
|
|
Tiers []PointsTier `json:"tiers"` // barème de points
|
|
}
|
|
|
|
// PenaltyTier représente un palier d'amende : à partir de MinCancel annulations, Amount est appliqué
|
|
type PenaltyTier struct {
|
|
MinCancel int `json:"min_cancel"` // nombre d'annulations à partir duquel ce palier s'applique
|
|
Amount int `json:"amount"` // montant de l'amende
|
|
}
|
|
|
|
// CategoryRoute associe un livreur à une ou plusieurs catégories de produits
|
|
type CategoryRoute struct {
|
|
DeliverymanUsername string `json:"deliveryman_username"`
|
|
Categories []string `json:"categories"`
|
|
}
|
|
|
|
// DeliveryModeConfig configure le mode d'assignation des livreurs
|
|
// Mode "single" → un seul livreur, toutes catégories confondues
|
|
// Mode "category_based" → chaque livreur gère ses catégories dédiées
|
|
type DeliveryModeConfig struct {
|
|
Mode string `json:"mode"` // "single" | "category_based"
|
|
CategoryRoutes []CategoryRoute `json:"category_routes"` // utilisé uniquement en mode category_based
|
|
}
|
|
|
|
// AppSettings contient les paramètres globaux de l'application
|
|
type AppSettings struct {
|
|
PenaltiesEnabled bool `json:"penalties_enabled"`
|
|
ShowAmendeScore bool `json:"show_amende_score"` // afficher le score d'amendes aux clients/cabine
|
|
PenaltyTiers []PenaltyTier `json:"penalty_tiers"` // barème des amendes (liste configurable)
|
|
PointsEnabled bool `json:"points_enabled"` // afficher/activer le système de points
|
|
PointsPools []PointsPool `json:"points_pools"` // types de points personnalisés
|
|
PointsReward *PointsReward `json:"points_reward"` // récompense globale par palier de points
|
|
ReferralEnabled bool `json:"referral_enabled"` // activer/désactiver le système de parrainage
|
|
ReferralAmount float64 `json:"referral_amount"` // montant crédité par parrainage
|
|
CryptoPaymentEnabled bool `json:"crypto_payment_enabled"` // activer/désactiver le paiement crypto
|
|
CryptoOnly bool `json:"crypto_only"` // forcer le paiement crypto uniquement (pas d'espèces)
|
|
NowPaymentsAPIKey string `json:"nowpayments_api_key"` // clé API NowPayments
|
|
NowPaymentsIPNSecret string `json:"nowpayments_ipn_secret"` // secret IPN NowPayments
|
|
NowPaymentsCurrencies []string `json:"nowpayments_currencies"` // cryptos acceptées (ex: ["btc","eth","ltc"])
|
|
DeliverySchedule DeliverySchedule `json:"delivery_schedule"` // horaires de livraison par jour
|
|
PostalZones []PostalZone `json:"postal_zones"` // zones de livraison avec minimum de commande
|
|
TelegramBotToken string `json:"telegram_bot_token"` // token du bot Telegram (BotFather) — pour le webhook de liaison
|
|
TelegramBotUsername string `json:"telegram_bot_username"` // username du bot (sans @)
|
|
TelegramNotificationsEnabled bool `json:"telegram_notifications_enabled"` // activer/désactiver les notifications Telegram
|
|
DeliveryMode DeliveryModeConfig `json:"delivery_mode"` // mode d'assignation des livreurs
|
|
ShopName string `json:"shop_name"` // nom affiché dans la sidebar du site client
|
|
Telegram2FAEnabled bool `json:"telegram_2fa_enabled"` // activer/désactiver l'authentification à deux facteurs
|
|
ContactTelegram string `json:"contact_telegram"` // numéro de téléphone Telegram du contact
|
|
// Palette de couleurs — espace admin
|
|
AdminColorPrimary string `json:"admin_color_primary"`
|
|
AdminColorSecondary string `json:"admin_color_secondary"`
|
|
AdminColorSuccess string `json:"admin_color_success"`
|
|
AdminColorDanger string `json:"admin_color_danger"`
|
|
AdminColorWarning string `json:"admin_color_warning"`
|
|
// Palette de couleurs — app client + site web
|
|
ClientColorPrimary string `json:"client_color_primary"`
|
|
ClientColorSecondary string `json:"client_color_secondary"`
|
|
ClientColorSuccess string `json:"client_color_success"`
|
|
ClientColorDanger string `json:"client_color_danger"`
|
|
ClientColorWarning string `json:"client_color_warning"`
|
|
// Dégradé du titre boutique sur le site web client
|
|
ClientTitleGradientFrom string `json:"client_title_gradient_from"`
|
|
ClientTitleGradientTo string `json:"client_title_gradient_to"`
|
|
}
|