%%%-------------------------------------------------------------------
%%% @author aresei
%%% @copyright (C) 2023, <COMPANY>
%%% @doc
%%%
%%% @end
%%% Created : 16. 5月 2023 12:48
%%%-------------------------------------------------------------------
-module(event_logs_bo).
-author("aresei").
-include("iot.hrl").

-export([insert/3]).

%% API

-spec insert(EventType :: integer(), AssocUUID :: binary(), Status :: integer()) ->
    {ok, InsertId :: integer()} | {error, Reason :: any()}.
insert(EventType, AssocUUID, Status) when is_integer(EventType), is_binary(AssocUUID), is_integer(Status) ->
    mysql_pool:insert(mysql_iot, <<"event_logs">>, #{
        <<"event_type">> => EventType,
        <<"assoc_uuid">> => AssocUUID,
        <<"status">> => Status,
        <<"created_at">> => calendar:local_time()
    }, true).