<script>
	/**
	 * @typedef {import('$lib/services/objectParser.js').TypedObject} TypedObject
	 */

	import Root from './Root.svelte';
	import Project from './Project.svelte';
	import Task from './Task.svelte';
	import Note from './Note.svelte';

	/** @type {{ object: TypedObject, depth?: number }} */
	let { object, depth = 0 } = $props();
</script>

<div class="object-renderer" style:padding-left={`${depth * 1.5}rem`}>
	{#if object.type === 'root'}
		<Root {object} {depth} />
	{:else if object.type === 'project'}
		<Project {object} {depth} />
	{:else if object.type === 'task'}
		<Task {object} {depth} />
	{:else if object.type === 'note'}
		<Note {object} {depth} />
	{:else}
		<p>Unknown object type: {object.type}</p>
	{/if}
</div>
