<script lang="ts" context="module">
    import {GetAniListItem} from "../wailsjs/go/main/App";
    import type {AniListGetSingleAnime} from "./anilist/types/AniListCurrentUserWatchListType.js";
    import {writable} from 'svelte/store'

    export let anime: AniListGetSingleAnime
    export let title = writable("")
    export let anilistModal = writable(false);

    export function GetAniListSingleItemAndOpenModal(aniId: number): void {
        GetAniListItem(aniId).then(result => {
            anime = result
            title.set(anime.data.MediaList.media.title.english === "" ?
                anime.data.MediaList.media.title.romaji :
                anime.data.MediaList.media.title.english)
            anilistModal.set(true)
        })
    }
</script>