using System;
using System.Linq;
using UnityEngine;

[CreateAssetMenu(fileName = "stantion_views_provider", menuName = "Stantion views")]
public sealed class StantionViewsProvider : ScriptableObject
{
    [SerializeField]
    private SpaceStantionView defaultViewPrefab = null;
    [SerializeField]
    private SpaceStantionView[] viewPrefabs = Array.Empty<SpaceStantionView>();

    public SpaceStantionView GetViewPrefab(string stantionId) {
        var item = viewPrefabs.FirstOrDefault(s => s.Id == stantionId);
        if (item != null)
            return item;
        return defaultViewPrefab;
    }
}