using System;
using System.Reflection;

namespace Inspectron.Settings.Avalonia.Configuration;

internal class SimplePropertyInfo : PropertyInfo
{
    private readonly Type _propertyType;
    private readonly string _name;

    public SimplePropertyInfo(Type propertyType, string name)
    {
        _propertyType = propertyType;
        _name = name;
    }

    public override PropertyAttributes Attributes => PropertyAttributes.None;
    public override bool CanRead => true;
    public override bool CanWrite => true;
    public override Type PropertyType => _propertyType;
    public override string Name => _name;
    public override Type DeclaringType => typeof(object);
    public override Type ReflectedType => typeof(object);

    public override MethodInfo[] GetAccessors(bool nonPublic) => new MethodInfo[0];
    public override MethodInfo GetGetMethod(bool nonPublic) => null;
    public override ParameterInfo[] GetIndexParameters() => new ParameterInfo[0];
    public override MethodInfo GetSetMethod(bool nonPublic) => null;
    public override object GetValue(object obj, BindingFlags invokeAttr, Binder binder, object[] index, System.Globalization.CultureInfo culture) => obj;
    public override void SetValue(object obj, object value, BindingFlags invokeAttr, Binder binder, object[] index, System.Globalization.CultureInfo culture) { }
    public override object[] GetCustomAttributes(Type attributeType, bool inherit) => new object[0];
    public override object[] GetCustomAttributes(bool inherit) => new object[0];
    public override bool IsDefined(Type attributeType, bool inherit) => false;
}
