// This file contains the enclosure with all the internal components, for a test fit.

use <internal_components.scad>
use <fabula_enclosure.scad>
use <keys.scad>
use <external_parts.scad>

explode_view = false;

color_buttons_vol = "#ffad00";
color_buttons_track = "#ff3100";
color_bottom = "#fff";
color_top = "#814abd";


module test_fit_components() {
    // Internal components
    translate([0, 30, 0]) speaker_80();
    translate([0, 0, 24.5]) pcb();
    translate([0, -28, 9]) rotate([0, 90, 0]) battery_18650();
    
    // Components that require cutout on external shell
    translate([-29, -71.5, 1]) rotate([0, 0, 90]) li_ion_4056_charger_module();
    color("#444") translate([-5, -92, 10]) rotate([90, 0, 0]) switch();
    color(color_buttons_vol) translate([-13.4, -20.1, 41.5]) vol_up_keycap();
    color(color_buttons_track) translate([12.6, -35.6, 41.5]) next_keycap();
    color(color_buttons_track) translate([-23.4, -44.6, 41.5]) prev_keycap();
    color(color_buttons_vol) translate([2.05, -61.05, 41.5]) vol_down_keycap();
    
    // Components mounted on the external shell
    color("#fff") translate([0, 50, explode_view ? 100 + 45 : 45]) character_retainer_ring();
    color(color_top) translate([explode_view ? 80 : 51, 10, explode_view ? 79 + 30 : 30]) rotate([90, 0, 0]) rotate([0, 270, 0]) sdcard_access_port();
}

test_fit_components();
color(color_bottom) translate([0, 0, explode_view ? -20 : 20]) rotate([0, 0, -90]) rotate([180, 0, 0]) fabula_enclosure_bottom();
color(color_top) translate([0, 0, explode_view ? 100 : 21]) rotate([0, 0, -90]) rotate([180, 0, 0]) fabula_enclosure_top();
