using System;
using System.Collections.Generic;
using System.Threading;
using Cysharp.Threading.Tasks;
using UnityEngine;

namespace Darkmatter.Core.Contracts.Services.Assets
{
    public interface IAssetProviderService
    {
        UniTask<GameObject> InstantiateAsync(
            string assetId,
            Vector3 position,
            Quaternion rotation,
            IProgress<float> progress,
            CancellationToken cancellationToken);

        UniTask<GameObject> InstantiateAsync(
            string assetId,
            IProgress<float> progress,
            CancellationToken cancellationToken);

        UniTask<T> LoadAssetAsync<T>(
            string assetId,
            IProgress<float> progress,
            CancellationToken cancellationToken);

        UniTask<IReadOnlyList<T>> LoadAssetsAsync<T>(
            IProgress<float> progress,
            CancellationToken cancellationToken);

        UniTask<IReadOnlyList<T>> LoadAssetsAsync<T>(
            object key,
            IProgress<float> progress,
            CancellationToken cancellationToken);

        void UnloadAsset(string assetId);

        UniTask LoadExternalCatalogAsync(
            string catalogUrl,
            IProgress<float> progress,
            CancellationToken cancellationToken);

        void ReleaseInstance(GameObject instance);
    }
}
