package com.alttd.altitudeweb.database.web_db.forms;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.Param;

import java.util.UUID;

public interface DiscordAppealMapper {

    @Insert("""
            INSERT INTO discord_appeals (uuid, discord_id, discord_username, reason, created_at, send_at, e_mail, assigned_to)
            VALUES (#{uuid}, #{discordId}, #{discordUsername}, #{reason}, #{createdAt}, #{sendAt}, #{email}, #{assignedTo})
            """)
    void createDiscordAppeal(DiscordAppeal discordAppeal);

    @Update("""
            UPDATE discord_appeals SET send_at = NOW()
            WHERE id = #{id}
            """)
    void markDiscordAppealAsSent(@Param("id") UUID id);

    @Update("""
            UPDATE discord_appeals SET assigned_to = #{assignedTo}
            WHERE id = #{id}
            """)
    void assignDiscordAppeal(@Param("id") UUID id, @Param("assignedTo") Long assignedTo);
}
