using System.Collections.Generic;

namespace Passer.Control
{

    public class CoreThing
    {
        public Participant participant;
        public byte networkId;
        public byte id;
        public CoreThing parent;
        public byte type;
        public string name;
        public string modelUrl;
        //protected Sensor sensor;

        protected virtual void Init()
        {
        }

        public CoreThing(Participant client, byte networkId, byte thingId, byte thingType = 0)
        {
            this.participant = client;
            this.id = thingId;
            this.type = thingType;
            this.networkId = networkId;
            this.Init();
            allThings.Add(this);
        }

        private static readonly List<CoreThing> allThings = new();

        public static CoreThing Get(byte networkId, byte thingId)
        {
            CoreThing thing = allThings.Find(aThing => aThing.networkId == networkId && aThing.id == thingId);
            return thing;
        }

    }
}