# A lightweight composition with inhabited roofs and a shared front veranda.
import argparse
from pathlib import Path
from hearth.randomness import Scope
from hearth.components import Blueprint, RoomSpec, FacadeDesign
from hearth.components.roofcraft import RoofDesign
from hearth.components.roomlayout import InteriorDesign
from hearth.lodges import lodge_scene
from hearth.persistence import export_scene


def roof_home(seed):
    rng = Scope(seed).stream('roof-home-layout')
    rooms = [RoomSpec(0, 0, 0, 'living'), RoomSpec(1, 0, 0, 'kitchen')]
    if rng.choice((False, True)):
        rooms.append(RoomSpec(1, 1, 0, rng.choice(('library', 'workshop'))))
    if rng.choice((False, True)):
        rooms.append(RoomSpec(0, 0, 1, 'library'))
    return Blueprint(tuple(rooms), bay=rng.choice((9, 11, 13)), roof_axis=rng.choice(('auto', 'z', 'x')), roof_design=RoofDesign(rng.choice(((1, 2), (1, 1, 2))), rng.choice((8, 11)), end_hips=Scope(seed).choose(((0, 0), (0, 2), (2, 2)), 'roof-ends')), attic_purpose=rng.choice(('bedroom', 'library')), porch_bays=2, porch_depth=4, chimney=True, facade_design=FacadeDesign(), rail_material='dark_oak', interior_design=InteriorDesign())


if __name__ == '__main__':
    parser = argparse.ArgumentParser()
    parser.add_argument('--seed', type=int, default=0)
    parser.add_argument('--environment-seed', type=int, default=0)
    parser.add_argument('--output', type=Path, default=Path('roof-home.litematic'))
    args = parser.parse_args()
    export_scene(lodge_scene(roof_home(args.seed), args.seed, args.environment_seed), args.output)
