-module(testcontainers_gleam). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]). -export([stop_container/1, start_container/1]). -export_type([config/0, start_info/0, container/0]). -type config() :: {config, binary(), integer()}. -type start_info() :: {start_info, binary(), integer()}. -type container() :: any(). -spec stop_container(binary()) -> gleam@erlang@atom:atom_(). stop_container(Container_id) -> 'Elixir.Testcontainers':stop_container(Container_id). -spec start_info_item( gleam@dict:dict(gleam@erlang@atom:atom_(), GDV), binary(), fun((GDV) -> {ok, GED} | {error, list(GEA)}) ) -> {ok, GED} | {error, list(GEA)}. start_info_item(Start_info, Key, Decoder) -> _pipe = Start_info, _pipe@1 = gleam@dict:get(_pipe, erlang:binary_to_atom(Key)), _pipe@2 = gleam@result:map_error(_pipe@1, fun(_) -> [] end), gleam@result:'try'(_pipe@2, Decoder). -spec start_container(config()) -> start_info(). start_container(Config) -> _assert_subject = 'Elixir.Testcontainers':start_link(), {ok, _} = case _assert_subject of {ok, _} -> _assert_subject; _assert_fail -> erlang:error(#{gleam_error => let_assert, message => <<"Assertion pattern match failed"/utf8>>, value => _assert_fail, module => <<"testcontainers_gleam"/utf8>>, function => <<"start_container"/utf8>>, line => 17}) end, Container = 'Elixir.Testcontainers.Container':new(erlang:element(2, Config)), Container@1 = 'Elixir.Testcontainers.Container':with_exposed_port( Container, erlang:element(3, Config) ), _assert_subject@1 = 'Elixir.Testcontainers':start_container(Container@1), {ok, Start_info} = case _assert_subject@1 of {ok, _} -> _assert_subject@1; _assert_fail@1 -> erlang:error(#{gleam_error => let_assert, message => <<"Assertion pattern match failed"/utf8>>, value => _assert_fail@1, module => <<"testcontainers_gleam"/utf8>>, function => <<"start_container"/utf8>>, line => 21}) end, _assert_subject@2 = start_info_item( Start_info, <<"container_id"/utf8>>, fun gleam@dynamic:string/1 ), {ok, Container_id} = case _assert_subject@2 of {ok, _} -> _assert_subject@2; _assert_fail@2 -> erlang:error(#{gleam_error => let_assert, message => <<"Assertion pattern match failed"/utf8>>, value => _assert_fail@2, module => <<"testcontainers_gleam"/utf8>>, function => <<"start_container"/utf8>>, line => 23}) end, _assert_subject@3 = start_info_item( Start_info, <<"exposed_ports"/utf8>>, gleam@dynamic:list( gleam@dynamic:tuple2( fun gleam@dynamic:int/1, fun gleam@dynamic:int/1 ) ) ), {ok, [{_, Port}]} = case _assert_subject@3 of {ok, [{_, _}]} -> _assert_subject@3; _assert_fail@3 -> erlang:error(#{gleam_error => let_assert, message => <<"Assertion pattern match failed"/utf8>>, value => _assert_fail@3, module => <<"testcontainers_gleam"/utf8>>, function => <<"start_container"/utf8>>, line => 25}) end, {start_info, Container_id, Port}.