- Remove duplicate calc structs, use model.CalcXxx - Replace log.Printf with logger in recommend handler - Remove dead code (unused var, dummy imports) - Clean up response helpers - Add api/ package with route registration Co-Authored-By: Claude <noreply@anthropic.com>
64 lines
2.5 KiB
Go
64 lines
2.5 KiB
Go
package model
|
|
|
|
// ── Calculator input ──────────────────────────────────────
|
|
|
|
type CalcRoomInput struct {
|
|
Name string `json:"name"`
|
|
Length float64 `json:"length"`
|
|
Width float64 `json:"width"`
|
|
Deductions []CalcDeduction `json:"deductions"`
|
|
}
|
|
|
|
type CalcDeduction struct {
|
|
Name string `json:"name"`
|
|
Shape string `json:"shape"` // rectangle, circle, custom
|
|
Length float64 `json:"length"`
|
|
Width float64 `json:"width"`
|
|
Radius float64 `json:"radius"`
|
|
Area float64 `json:"area"`
|
|
}
|
|
|
|
type CalcInput struct {
|
|
FloorType string `json:"floor_type"`
|
|
Rooms []CalcRoomInput `json:"rooms"`
|
|
PatternIndex int `json:"pattern_index"`
|
|
PieceLength float64 `json:"piece_length"`
|
|
PieceWidth float64 `json:"piece_width"`
|
|
PiecesPerBox int `json:"pieces_per_box"`
|
|
PricePerSqm float64 `json:"price_per_sqm"`
|
|
JointWidth float64 `json:"joint_width"`
|
|
}
|
|
|
|
// ── Calculator output ─────────────────────────────────────
|
|
|
|
type CalcRoomResult struct {
|
|
Name string `json:"name"`
|
|
Length float64 `json:"length"`
|
|
Width float64 `json:"width"`
|
|
Area float64 `json:"area"`
|
|
Deductions []CalcDeduction `json:"deductions"`
|
|
DeductionTotal float64 `json:"deduction_total"`
|
|
NetArea float64 `json:"net_area"`
|
|
}
|
|
|
|
type CalcResult struct {
|
|
FloorType string `json:"floor_type"`
|
|
Rooms []CalcRoomResult `json:"rooms"`
|
|
TotalRoomArea float64 `json:"total_room_area"`
|
|
TotalDeduct float64 `json:"total_deduct"`
|
|
TotalNetArea float64 `json:"total_net_area"`
|
|
WasteRate float64 `json:"waste_rate"`
|
|
WasteArea float64 `json:"waste_area"`
|
|
TotalArea float64 `json:"total_area"`
|
|
PiecesNeeded int `json:"pieces_needed"`
|
|
BoxesNeeded *float64 `json:"boxes_needed,omitempty"`
|
|
JointWidth float64 `json:"joint_width"`
|
|
GroutKg *float64 `json:"grout_kg,omitempty"`
|
|
GroutBags *int `json:"grout_bags,omitempty"`
|
|
PricePerSqm float64 `json:"price_per_sqm"`
|
|
TotalPrice *float64 `json:"total_price,omitempty"`
|
|
PatternName string `json:"pattern_name"`
|
|
PieceLength float64 `json:"piece_length"`
|
|
PieceWidth float64 `json:"piece_width"`
|
|
}
|