# A later client composes a public gallery with connected reading and work rooms.
import argparse
from pathlib import Path
from hearth.components.building import Blueprint, RoomSpec
from hearth.programs import building_scene
from hearth.randomness import Scope
from hearth.persistence import export_scene
from extension_demo import Pendant


def build(seed):
    rng = Scope(seed).stream('gallery-layout')
    length = rng.choice((2, 3))
    rooms = [RoomSpec(0, z, 0, 'library' if z % 2 else 'living') for z in range(length)]
    rooms.append(RoomSpec(1, length - 1, 0, 'workshop'))
    rooms.append(RoomSpec(0, length - 1, 1, 'bedroom'))
    return building_scene(Blueprint(tuple(rooms), bay=9, roof_axis='z', light_component=Pendant()), seed)


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