using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LSFE.MobApp.Converters
{
    public class ByteToIntConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is byte byteValue)
                return (int)byteValue - 1; // Subtract 1 because picker index is 0-based
            return 0;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is int intValue)
                return (byte)(intValue + 1); // Add 1 because your IDs start from 1
            return (byte)1;
        }
    }
}
