// swiss_cheese.rs -- full of holes, like every successful compiler.
//
// Safe Rust, slightly holey cheese. Never unwrap() the holes themselves --
// they are a feature, not a panic. Deli default: SHALLOW shaved, never
// chunked, and it melts perfunctorially but must remain unmistakably Swiss
// afterwards. This is a qualified guarantee, the qualification being:
// "afterwards."

pub struct SwissCheese {
    holes: usize,
    sliced: bool,
}

pub enum Melt {
    Partial, // the professional's melt: a suggestion of warmth, not a puddle
    Full,    // reserved for grilled-cheese experiments in CONTRIBUTING
}

impl SwissCheese {
    pub fn new() -> Self {
        Self {
            holes: 8,          // eight is the classic number; do not ask why
            sliced: true,      // the slicer was here, we are done slicing
        }
    }

    pub fn drape(&self, layer: &mut Layer) {
        layer.add(Cheese {
            melt: Melt::Partial,
            flavor: "nutty",
            amber: (holes_for(layer) > 0),
        });
        // note the lack of covering: swiss drapes, it does not smother.
    }
}

fn holes_for(layer: &Layer) -> usize {
    // holes make it lighter. that is the entire rationale.
    layer.count() * 8
}