113 lines
4.1 KiB
Go
113 lines
4.1 KiB
Go
package contract
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
type SelfOrderTableTokenResponse struct {
|
|
SessionID string `json:"session_id"`
|
|
TableID string `json:"table_id"`
|
|
OrganizationID string `json:"organization_id"`
|
|
OutletID string `json:"outlet_id"`
|
|
TableName string `json:"table_name"`
|
|
OutletName string `json:"outlet_name"`
|
|
Status string `json:"status"`
|
|
}
|
|
|
|
type SelfOrderMenuRequest struct {
|
|
SessionID string `form:"session_id" validate:"required"`
|
|
}
|
|
|
|
type SelfOrderMenuResponse struct {
|
|
OutletName string `json:"outlet_name"`
|
|
TableName string `json:"table_name"`
|
|
Categories []SelfOrderMenuCategory `json:"categories"`
|
|
}
|
|
|
|
type SelfOrderMenuCategory struct {
|
|
ID uuid.UUID `json:"id"`
|
|
Name string `json:"name"`
|
|
Description *string `json:"description,omitempty"`
|
|
Order int `json:"order"`
|
|
Products []SelfOrderMenuItem `json:"products"`
|
|
}
|
|
|
|
type SelfOrderMenuItem struct {
|
|
ID uuid.UUID `json:"id"`
|
|
Name string `json:"name"`
|
|
Description *string `json:"description,omitempty"`
|
|
Price float64 `json:"price"`
|
|
ImageURL *string `json:"image_url,omitempty"`
|
|
Variants []SelfOrderMenuVariant `json:"variants,omitempty"`
|
|
}
|
|
|
|
type SelfOrderMenuVariant struct {
|
|
ID uuid.UUID `json:"id"`
|
|
Name string `json:"name"`
|
|
PriceModifier float64 `json:"price_modifier"`
|
|
}
|
|
|
|
type SelfOrderCreateOrderRequest struct {
|
|
SessionID string `json:"session_id" validate:"required"`
|
|
OrderItems []SelfOrderCreateOrderItem `json:"order_items" validate:"required,min=1,dive"`
|
|
}
|
|
|
|
type SelfOrderCreateOrderItem struct {
|
|
ProductID uuid.UUID `json:"product_id" validate:"required"`
|
|
ProductVariantID *uuid.UUID `json:"product_variant_id,omitempty"`
|
|
Quantity int `json:"quantity" validate:"required,min=1"`
|
|
Notes *string `json:"notes,omitempty"`
|
|
}
|
|
|
|
type SelfOrderListCategoriesRequest struct {
|
|
OrganizationID string `form:"organisasi_id" validate:"required"`
|
|
OutletID string `form:"outlet_id" validate:"required"`
|
|
}
|
|
|
|
type SelfOrderCategoryItem struct {
|
|
ID uuid.UUID `json:"id"`
|
|
Name string `json:"name"`
|
|
Description *string `json:"description,omitempty"`
|
|
Order int `json:"order"`
|
|
}
|
|
|
|
type SelfOrderListCategoriesResponse struct {
|
|
Categories []SelfOrderCategoryItem `json:"categories"`
|
|
}
|
|
|
|
type SelfOrderListOrdersResponse struct {
|
|
Orders []SelfOrderOrderItem `json:"orders"`
|
|
}
|
|
|
|
type SelfOrderOrderItem struct {
|
|
ID uuid.UUID `json:"id"`
|
|
OrderNumber string `json:"order_number"`
|
|
TableNumber *string `json:"table_number,omitempty"`
|
|
OrderType string `json:"order_type"`
|
|
Status string `json:"status"`
|
|
Subtotal float64 `json:"subtotal"`
|
|
TaxAmount float64 `json:"tax_amount"`
|
|
DiscountAmount float64 `json:"discount_amount"`
|
|
TotalAmount float64 `json:"total_amount"`
|
|
RemainingAmount float64 `json:"remaining_amount"`
|
|
PaymentStatus string `json:"payment_status"`
|
|
IsVoid bool `json:"is_void"`
|
|
IsRefund bool `json:"is_refund"`
|
|
Items []SelfOrderOrderLineItem `json:"items,omitempty"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
}
|
|
|
|
type SelfOrderOrderLineItem struct {
|
|
ProductID uuid.UUID `json:"product_id"`
|
|
ProductName string `json:"product_name"`
|
|
ProductVariantID *uuid.UUID `json:"product_variant_id,omitempty"`
|
|
ProductVariantNam *string `json:"product_variant_name,omitempty"`
|
|
Quantity int `json:"quantity"`
|
|
UnitPrice float64 `json:"unit_price"`
|
|
TotalPrice float64 `json:"total_price"`
|
|
Notes *string `json:"notes,omitempty"`
|
|
Status string `json:"status"`
|
|
}
|