# Substitute independent lighting and encapsulate an independently packaged room.
import argparse
from pathlib import Path
from hearth import Scene, Box, Frame
from hearth.kernel import Registry
from hearth.components.interior import Light
from hearth.components.building import Blueprint, RoomSpec
from hearth.programs import building_scene
from hearth.persistence import export_scene
from extension_demo import Pendant, ReadingSuite


def build(seed):
    registry = Registry()
    registry.register(Light())
    registry.register(Pendant())
    lights = registry.select('room-light')
    design = Blueprint((RoomSpec(0, 0, 0, 'library'), RoomSpec(0, 0, 1, 'bedroom')), light_component=lights[seed % len(lights)])
    return building_scene(design, seed)


if __name__ == '__main__':
    p = argparse.ArgumentParser()
    p.add_argument('--seed', type=int, default=0)
    p.add_argument('--output', type=Path, default=Path('samples/extension.litematic'))
    a = p.parse_args()
    export_scene(build(a.seed), a.output)
