package core

new_initial_state :: proc() -> Comic_State {
	iso := ""

	return Comic_State{
		project = Project_Metadata{
			project_id = "proj_todo",
			project_name = "Untitled Comic",
			created_at_iso = iso,
			last_modified_iso = iso,
		},
		user_mode = .Casual,
		story_idea = "",
		story_genre = "action",
		target_audience = "general",
		art_style = "manga",
		export_format = .PDF,
		page_size = .A4,
		color_profile = .RGB,
		workflow = Workflow_State{
			current_step = .Story_Input,
			completed_steps = nil,
			is_generating = false,
			generation_progress = 0,
			error_message = "",
		},
		panel_images = nil,
		panel_errors = nil,
		speech_bubbles = nil,
	}
}

set_workflow_step :: proc(state: ^Comic_State, step: Workflow_Step) {
	state.workflow.current_step = step

	for s in state.workflow.completed_steps {
		if s == step {
			return
		}
	}

	old_steps := state.workflow.completed_steps
	steps: [dynamic]Workflow_Step
	for s in old_steps {
		append(&steps, s)
	}
	append(&steps, step)
	state.workflow.completed_steps = steps[:]
	delete(old_steps)
}
