44 lines
2 KiB
Go
44 lines
2 KiB
Go
package domain
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/gofrs/uuid/v5"
|
|
)
|
|
|
|
// ShippingMethodType defines supported fulfillment modes.
|
|
type ShippingMethodType string
|
|
|
|
const (
|
|
ShippingMethodPickup ShippingMethodType = "pickup"
|
|
ShippingMethodOwnDelivery ShippingMethodType = "own_delivery"
|
|
ShippingMethodThirdParty ShippingMethodType = "third_party_delivery"
|
|
ShippingOptionTypePickup = "pickup"
|
|
ShippingOptionTypeDelivery = "delivery"
|
|
)
|
|
|
|
// ShippingMethod stores vendor configuration for pickup or delivery.
|
|
type ShippingMethod struct {
|
|
ID uuid.UUID `db:"id" json:"id"`
|
|
VendorID uuid.UUID `db:"vendor_id" json:"vendor_id"`
|
|
Type ShippingMethodType `db:"type" json:"type"`
|
|
Active bool `db:"active" json:"active"`
|
|
PreparationMinutes int `db:"preparation_minutes" json:"preparation_minutes"`
|
|
MaxRadiusKm float64 `db:"max_radius_km" json:"max_radius_km"`
|
|
MinFeeCents int64 `db:"min_fee_cents" json:"min_fee_cents"`
|
|
PricePerKmCents int64 `db:"price_per_km_cents" json:"price_per_km_cents"`
|
|
FreeShippingThresholdCents *int64 `db:"free_shipping_threshold_cents" json:"free_shipping_threshold_cents,omitempty"`
|
|
PickupAddress string `db:"pickup_address" json:"pickup_address"`
|
|
PickupHours string `db:"pickup_hours" json:"pickup_hours"`
|
|
CreatedAt time.Time `db:"created_at" json:"created_at"`
|
|
UpdatedAt time.Time `db:"updated_at" json:"updated_at"`
|
|
}
|
|
|
|
// ShippingOption presents calculated options to the buyer.
|
|
type ShippingOption struct {
|
|
Type string `json:"type"`
|
|
ValueCents int64 `json:"value_cents"`
|
|
EstimatedMinutes int `json:"estimated_minutes"`
|
|
Description string `json:"description"`
|
|
DistanceKm float64 `json:"distance_km,omitempty"`
|
|
}
|