Files
ccn/Services/Website/Sources/Library/Internal/Enumerations/Grading.swift
T

82 lines
3.9 KiB
Swift

/// The grading guide's vocabulary: the scale raw books are graded on, and the defects every listing declares.
///
/// Single-sourced: the public guide prints it, the listing form offers it, and the form's checks apply it.
enum Grading {
// MARK: Constants
/// The conditions a collected edition — ungraded — is sold in, best first.
static let conditions = ["Sealed", "Like new", "Very good", "Good", "Acceptable"]
/// The companies that grade and slab.
static let graders = ["CGC", "CBCS", "PGX"]
/// The highest grade a raw book with a colour-breaking crease can carry.
static let creaseCap = 7.0
/// The page qualities a grader states, best first.
static let pageQualities = ["White", "Off-white to white", "Off-white", "Cream"]
/// The scale, best first: each grade and its code.
static let scale: [(grade: Double, code: String)] = [
(10.0, "GM"), (9.8, "NM/M"), (9.6, "NM+"), (9.4, "NM"), (9.2, "NM-"), (9.0, "VF/NM"),
(8.5, "VF+"), (8.0, "VF"), (7.5, "VF-"), (7.0, "FN/VF"), (6.5, "FN+"), (6.0, "FN"),
(5.0, "VG/FN"), (4.0, "VG"), (3.0, "GD/VG"), (2.0, "GD"), (1.0, "FR"), (0.5, "PR"),
]
/// The grades the guide illustrates: what each allows, and what rules a book out of it.
static let references: [(grade: Double, name: String, allowed: String, excluded: String)] = [
(9.8, "Near mint / mint", "Nearly perfect. Flat, glossy, sharp corners, tight staples. Up to one tiny bindery tear.", "Any spine stress you can see without tilting the book. Any crease."),
(9.4, "Near mint", "A few very small spine ticks, a light corner bend. Full gloss.", "Colour breaks. Writing. Foxing."),
(8.0, "Very fine", "Light wear: a few spine ticks, minor corner blunting, slight gloss loss.", "Colour-breaking creases longer than 1 cm. Tears."),
(6.5, "Fine +", "Moderate wear. A colour-breaking crease or two, some spine roll, small arrival date is fine.", "Missing pieces. Detached cover."),
(4.0, "Very good", "Well read. Multiple creases, rounded corners, possible small tear or staple rust.", "Water damage across the cover. Missing pages."),
(2.0, "Good", "Complete but heavily worn. Tears, writing, cover may be loose at one staple.", "Anything missing — that's Fair or Poor."),
]
}
// MARK: - Enumerations
extension Grading {
/// A box on the defect checklist.
enum Defect: String, CaseIterable, Sendable {
case spineStress = "spine-stress"
case crease
case cornerWear = "corner-wear"
case foxing
case tears
case writing
case detached
case caseScuffs = "case-scuffs"
/// What the box means.
var definition: String {
switch self {
case .spineStress: "Small non-colour-breaking lines along the spine from opening the book."
case .crease: "A fold that has cracked the ink. Caps a raw book at 7.0 or below."
case .cornerWear: "Rounded or frayed corners."
case .foxing: "Brown spots or tide marks; usually humidity."
case .tears: "Any loss of paper. Describe size and location."
case .writing: "Arrival dates, names, distributor stamps."
case .detached: "Cover loose at one or both staples; rusted staples."
case .caseScuffs: "Slabs only: scratches or cracks on the holder, not the book."
}
}
/// The box's name, as listings declare it.
var label: String {
switch self {
case .spineStress: "Spine stress / ticks"
case .crease: "Colour-breaking crease"
case .cornerWear: "Corner wear / blunting"
case .foxing: "Foxing / staining"
case .tears: "Tears or missing pieces"
case .writing: "Writing / stamps"
case .detached: "Detached cover / staples"
case .caseScuffs: "Case scuffs / cracks"
}
}
}
}