-module(telega@flow@types). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]). -define(FILEPATH, "src/telega/flow/types.gleam"). -export_type([flow_state/0, flow_stack_frame/0, parallel_state/0, flow_instance/0, wait_result/0, flow_instance_row/0, flow_storage/1, step_config/3, conditional_transition/1, parallel_config/1, subflow_config/3, flow_action/1, flow/3, flow_trigger/0, inline_step/0, composed_step/0]). -if(?OTP_RELEASE >= 27). -define(MODULEDOC(Str), -moduledoc(Str)). -define(DOC(Str), -doc(Str)). -else. -define(MODULEDOC(Str), -compile([])). -define(DOC(Str), -compile([])). -endif. ?MODULEDOC( " Shared type definitions for the flow system.\n" "\n" " This module contains all types used across flow submodules.\n" ). -type flow_state() :: {flow_state, binary(), gleam@dict:dict(binary(), binary()), list(binary()), list(flow_stack_frame()), gleam@option:option(parallel_state())}. -type flow_stack_frame() :: {flow_stack_frame, binary(), binary(), gleam@dict:dict(binary(), binary())}. -type parallel_state() :: {parallel_state, list(binary()), list(binary()), gleam@dict:dict(binary(), gleam@dict:dict(binary(), binary())), binary()}. -type flow_instance() :: {flow_instance, binary(), binary(), integer(), integer(), flow_state(), gleam@dict:dict(binary(), binary()), gleam@option:option(binary()), gleam@option:option(integer()), integer(), integer()}. -type wait_result() :: {text_input, binary()} | {bool_callback, boolean()} | {data_callback, binary()} | {photo_input, list(binary())} | {video_input, binary()} | {voice_input, binary()} | {audio_input, binary()} | {location_input, float(), float()} | {command_input, binary(), binary()} | pending. -type flow_instance_row() :: {flow_instance_row, binary(), binary(), integer(), integer(), binary(), gleam@dict:dict(binary(), binary()), gleam@dict:dict(binary(), binary()), gleam@option:option(binary()), gleam@option:option(integer()), integer(), integer()}. -type flow_storage(AKZP) :: {flow_storage, fun((flow_instance()) -> {ok, nil} | {error, AKZP}), fun((binary()) -> {ok, gleam@option:option(flow_instance())} | {error, AKZP}), fun((binary()) -> {ok, nil} | {error, AKZP}), fun((integer(), integer()) -> {ok, list(flow_instance())} | {error, AKZP})}. -type step_config(AKZQ, AKZR, AKZS) :: {step_config, fun((telega@bot:context(AKZR, AKZS), flow_instance()) -> {ok, {telega@bot:context(AKZR, AKZS), flow_action(AKZQ), flow_instance()}} | {error, AKZS}), list(fun((telega@bot:context(AKZR, AKZS), flow_instance(), fun(() -> {ok, {telega@bot:context(AKZR, AKZS), flow_action(AKZQ), flow_instance()}} | {error, AKZS})) -> {ok, {telega@bot:context(AKZR, AKZS), flow_action(AKZQ), flow_instance()}} | {error, AKZS})), gleam@option:option(fun((telega@bot:context(AKZR, AKZS), flow_instance()) -> {ok, {telega@bot:context(AKZR, AKZS), flow_instance()}} | {error, AKZS})), gleam@option:option(fun((telega@bot:context(AKZR, AKZS), flow_instance()) -> {ok, {telega@bot:context(AKZR, AKZS), flow_instance()}} | {error, AKZS}))}. -type conditional_transition(AKZT) :: {conditional_transition, binary(), list({fun((flow_instance()) -> boolean()), AKZT}), AKZT}. -type parallel_config(AKZU) :: {parallel_config, binary(), list(AKZU), AKZU}. -type subflow_config(AKZV, AKZW, AKZX) :: {subflow_config, binary(), flow(gleam@dynamic:dynamic_(), AKZW, AKZX), AKZV, fun((flow_instance()) -> gleam@dict:dict(binary(), binary())), fun((gleam@dict:dict(binary(), binary()), flow_instance()) -> flow_instance())}. -type flow_action(AKZY) :: {next, AKZY} | {next_string, binary()} | back | {complete, gleam@dict:dict(binary(), binary())} | cancel | wait | wait_callback | {wait_with_timeout, integer()} | {wait_callback_with_timeout, integer()} | {go_to, AKZY} | {exit, gleam@option:option(gleam@dict:dict(binary(), binary()))} | {return_from_subflow, gleam@dict:dict(binary(), binary())} | {start_parallel, list(AKZY), AKZY} | {complete_parallel_step, AKZY, gleam@dict:dict(binary(), binary())} | {enter_subflow, binary(), gleam@dict:dict(binary(), binary())}. -type flow(AKZZ, ALAA, ALAB) :: {flow, binary(), gleam@dict:dict(binary(), step_config(AKZZ, ALAA, ALAB)), AKZZ, fun((AKZZ) -> binary()), fun((binary()) -> {ok, AKZZ} | {error, nil}), flow_storage(ALAB), gleam@option:option(fun((telega@bot:context(ALAA, ALAB), flow_instance()) -> {ok, telega@bot:context(ALAA, ALAB)} | {error, ALAB})), gleam@option:option(fun((telega@bot:context(ALAA, ALAB), flow_instance(), gleam@option:option(ALAB)) -> {ok, telega@bot:context(ALAA, ALAB)} | {error, ALAB})), list(fun((telega@bot:context(ALAA, ALAB), flow_instance(), fun(() -> {ok, {telega@bot:context(ALAA, ALAB), flow_action(AKZZ), flow_instance()}} | {error, ALAB})) -> {ok, {telega@bot:context(ALAA, ALAB), flow_action(AKZZ), flow_instance()}} | {error, ALAB})), list(conditional_transition(AKZZ)), list(parallel_config(AKZZ)), list(subflow_config(AKZZ, ALAA, ALAB)), gleam@option:option(fun((telega@bot:context(ALAA, ALAB), flow_instance()) -> {ok, {telega@bot:context(ALAA, ALAB), flow_instance()}} | {error, ALAB})), gleam@option:option(fun((telega@bot:context(ALAA, ALAB), flow_instance()) -> {ok, {telega@bot:context(ALAA, ALAB), flow_instance()}} | {error, ALAB})), gleam@option:option(fun((telega@bot:context(ALAA, ALAB), flow_instance()) -> {ok, telega@bot:context(ALAA, ALAB)} | {error, ALAB})), gleam@option:option(integer()), gleam@option:option(fun((telega@bot:context(ALAA, ALAB), flow_instance()) -> {ok, telega@bot:context(ALAA, ALAB)} | {error, ALAB}))}. -type flow_trigger() :: {on_command, binary()} | {on_text, telega@router:pattern()} | {on_callback, telega@router:pattern()} | {on_filtered, telega@router:filter()} | on_photo | on_video | on_audio | on_voice | on_any_text. -type inline_step() :: {inline_step, binary()}. -type composed_step() :: {composed_flow_step, integer()} | composed_select_flow | composed_start_parallel | {composed_parallel_flow, integer()} | composed_merge_results.