aboutsummaryrefslogtreecommitdiffstats
path: root/pkgid.go
diff options
context:
space:
mode:
authorSam Anthony <sam@samanthony.xyz>2026-05-06 21:19:12 -0400
committerSam Anthony <sam@samanthony.xyz>2026-05-06 21:19:12 -0400
commit2990789d98405291bfbb3e0dce4efca1153120ab (patch)
treed7bdc19b28909bdc2d5abf24f2c3575d199463ae /pkgid.go
parentb6b81ac135e77f7856efb07389a6ac42cc137a6e (diff)
downloadlulu-2990789d98405291bfbb3e0dce4efca1153120ab.zip
implement POST /validate-interior
Diffstat (limited to 'pkgid.go')
-rw-r--r--pkgid.go117
1 files changed, 117 insertions, 0 deletions
diff --git a/pkgid.go b/pkgid.go
new file mode 100644
index 0000000..95b6303
--- /dev/null
+++ b/pkgid.go
@@ -0,0 +1,117 @@
+package lulu
+
+import (
+ "encoding/json"
+ "fmt"
+)
+
+// PkgId is a pod_package_id which represents the manufacturing options
+// of a printable.
+type PkgId struct {
+ TrimSize
+ ColorType
+ Quality
+ Binding
+ Paper
+ Finish
+ Linen
+ Foil
+}
+
+func (p PkgId) MarshalJSON() ([]byte, error) {
+ return json.Marshal(fmt.Sprintf("%s.%s.%s.%s.%s.%s%s%s", p.TrimSize, p.ColorType, p.Quality, p.Binding, p.Paper, p.Finish, p.Linen, p.Foil))
+}
+
+// TrimSize is the final dimensions of the pages after the bleed margins
+// are trimmed off.
+type TrimSize string
+
+const (
+ Pocketbook TrimSize = "0425X0687"
+ Novella = "0500X0800"
+ Digest = "0550X0850"
+ A5 = "0583X0827"
+ UsTrade = "0600X0900"
+ Royal = "0614X0921"
+ Comic = "0663X1025"
+ SmallSquare = "0750X0750"
+ Executive = "0700X1000"
+ CrownQuatro = "0744X0968"
+ Square = "0850X0850"
+ A4 = "0827X1169"
+ UsLetter = "0850X1100"
+ Landscape = "0900X0700"
+ UsLetterLandscape = "1100X0850"
+ A4Landscape = "1169X0827"
+)
+
+// ColorType is the color mode of the printer.
+type ColorType string
+
+const (
+ Mono ColorType = "BW"
+ Color = "FC"
+)
+
+// Quality is the print quality.
+type Quality string
+
+const (
+ Premium Quality = "PRE"
+ Standard = "STD"
+)
+
+type Binding string
+
+const (
+ Perfect Binding = "PB"
+ Coil = "CO"
+ SaddleStitch = "SS"
+ CaseWrap = "CW"
+ LinenWrap = "LW"
+ WireO = "WO"
+)
+
+// Paper is the weight/thickness and hue of the paper.
+type Paper string
+
+const (
+ P60UncoatedWhite Paper = "060UW444"
+ P60UncoatedCream = "060UC444"
+ P70CoatedWhite = "070CW460"
+ P80CoatedWhite = "080CW444"
+ P100CoatedWhite = "100CW"
+)
+
+// Finish is the surface finish of the cover.
+type Finish string
+
+const (
+ Gloss Finish = "G"
+ Matte = "M"
+ Unlaminated = "U"
+)
+
+// Linen is the color of the linen-wrapped cover, if applicable.
+type Linen string
+
+const (
+ RedLinen Linen = "R"
+ NavyLinen = "N"
+ BlackLinen = "B"
+ GrayLinen = "G"
+ TanLinen = "T"
+ ForestLinen = "F"
+ InteriorCoverPrint = "I"
+ NoLinen = "X"
+)
+
+// Foil is the color of the foil stamping, if applicable.
+type Foil string
+
+const (
+ GoldFoil Foil = "G"
+ BlackFoil = "B"
+ WhiteFoil = "W"
+ NoFoil = "X"
+)