using CommunityToolkit.Mvvm.ComponentModel;

using CtrEditor.Siemens;
using System.Windows;
using System.Windows.Controls;


namespace CtrEditor.ObjetosSim
{
    /// <summary>
    /// Interaction logic for ucConsensGeneric.xaml
    /// </summary>
    public partial class osConsensGeneric : osBase, IosBase
    {

        public TagsConsensos Consensos = new TagsConsensos();

        [ObservableProperty]
        public List<string> tags;

        // Otros datos y métodos relevantes para la simulación

        public static string NombreClase()
        {
            return "Consensi";
        }
        private string nombre = NombreClase();
        public override string Nombre
        {
            get => nombre;
            set => SetProperty(ref nombre, value);
        }

        [ObservableProperty]
        public float tamano;

        public override void ucLoaded()
        {
            // El UserControl ya se ha cargado y podemos obtener las coordenadas para 
            // crear el objeto de simulacion
            ActualizarLeftTop();

            //if (_visualRepresentation is ucConsensGeneric uc)
            //    Tags = UserControlFactory.CargarPropiedadesosDatosTags(Consensos, uc.PanelEdicion, null);

        }
    }

    public partial class ucConsensGeneric : UserControl, IDataContainer
    {
        public osBase? Datos { get; set; }

        public ucConsensGeneric()
        {
            InitializeComponent();
            this.Loaded += OnLoaded;
            this.Unloaded += OnUnloaded;
        }
        private void OnLoaded(object sender, RoutedEventArgs e)
        {
            Datos?.ucLoaded();
        }
        private void OnUnloaded(object sender, RoutedEventArgs e)
        {
            Datos?.ucUnLoaded();
        }
        public void Resize(float width, float height) { }
        public void Move(float LeftPixels, float TopPixels)
        {
            if (Datos != null)
            {
                Datos.Left = PixelToMeter.Instance.calc.PixelsToMeters(LeftPixels);
                Datos.Top = PixelToMeter.Instance.calc.PixelsToMeters(TopPixels);
            }
        }
        public void Rotate(float Angle) { }
        public void Highlight(bool State) { }
        public int ZIndex()
        {
            return 10;
        }
    }

    public class TagsConsensos
    {
        public string Tag { get; set; }
        public bool Consenso_Uscita { get; set; }
        public string Velocidad { get; set; }
    }

}

