-module(automata@event@builtin@match).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]).
-define(FILEPATH, "src/automata/event/builtin/match.gleam").
-export([is_scheduled/1, is_schedule_kind/2, is_file_event/1, is_file_with_op/2, is_manual/1, is_custom/1, is_custom_kind/2]).
-if(?OTP_RELEASE >= 27).
-define(MODULEDOC(Str), -moduledoc(Str)).
-define(DOC(Str), -doc(Str)).
-else.
-define(MODULEDOC(Str), -compile([])).
-define(DOC(Str), -compile([])).
-endif.
-file("src/automata/event/builtin/match.gleam", 6).
-spec is_scheduled(
automata@event:event(automata@event@builtin@body:event_body())
) -> boolean().
is_scheduled(Event) ->
case erlang:element(5, Event) of
{scheduled, _, _, _} ->
true;
_ ->
false
end.
-file("src/automata/event/builtin/match.gleam", 13).
-spec is_schedule_kind(
automata@event:event(automata@event@builtin@body:event_body()),
automata@event@builtin@body:schedule_kind()
) -> boolean().
is_schedule_kind(Event, Kind) ->
case erlang:element(5, Event) of
{scheduled, _, _, K} ->
K =:= Kind;
_ ->
false
end.
-file("src/automata/event/builtin/match.gleam", 25).
?DOC(
" `True` when the event's body is a `FileSystem(_)` variant. Use\n"
" `is_file_with_op` to discriminate by `Op`.\n"
).
-spec is_file_event(
automata@event:event(automata@event@builtin@body:event_body())
) -> boolean().
is_file_event(Event) ->
case erlang:element(5, Event) of
{file_system, _} ->
true;
_ ->
false
end.
-file("src/automata/event/builtin/match.gleam", 36).
?DOC(
" `True` when the event's body is `FileSystem(_)` and the wrapped\n"
" `WatchEvent` carries `op` in its op set. This replaces the legacy\n"
" `is_file_created/modified/deleted/renamed` helpers; pass `Create`,\n"
" `Write`, `Remove`, `Rename`, or `Chmod` for the same effect.\n"
).
-spec is_file_with_op(
automata@event:event(automata@event@builtin@body:event_body()),
automata@fsevent@ast:op()
) -> boolean().
is_file_with_op(Event, Op) ->
case erlang:element(5, Event) of
{file_system, Watch_event} ->
automata@fsevent@event:event_has(Watch_event, Op);
_ ->
false
end.
-file("src/automata/event/builtin/match.gleam", 43).
-spec is_manual(automata@event:event(automata@event@builtin@body:event_body())) -> boolean().
is_manual(Event) ->
case erlang:element(5, Event) of
{manual, _, _} ->
true;
_ ->
false
end.
-file("src/automata/event/builtin/match.gleam", 50).
-spec is_custom(automata@event:event(automata@event@builtin@body:event_body())) -> boolean().
is_custom(Event) ->
case erlang:element(5, Event) of
{custom, _, _} ->
true;
_ ->
false
end.
-file("src/automata/event/builtin/match.gleam", 57).
-spec is_custom_kind(
automata@event:event(automata@event@builtin@body:event_body()),
binary()
) -> boolean().
is_custom_kind(Event, Kind) ->
case erlang:element(5, Event) of
{custom, Name, _} ->
Name =:= Kind;
_ ->
false
end.