// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
namespace CommunityToolkit.Mvvm.ComponentModel;
///
/// An attribute that indicates that a given type should have all the members from
/// generated into it. This can be useful when you want the same functionality from into
/// a class that already inherits from another one (since C# doesn't support multiple inheritance). This attribute will trigger
/// the source generator to just create the same APIs directly into the decorated class. For instance, this attribute can be
/// used to easily combine the functionality from both and ,
/// by using as the base class and adding this attribute to the declared type.
///
/// This attribute can be used as follows:
///
/// [ObservableRecipient]
/// partial class MyViewModel : ObservableValidator
/// {
/// // Other members here...
/// }
///
///
/// And with this, the same APIs from will be available on this type as well.
///
/// To avoid conflicts with other APIs in types where the new members are being generated, constructors are only generated when the annotated
/// type doesn't have any explicit constructors being declared. If that is the case, the same constructors from
/// are emitted, with the accessibility adapted to that of the annotated type. Otherwise, they are skipped, so the type being annotated has the
/// respondibility of properly initializing the property. Additionally, if the annotated type inherits
/// from , the overloads will be skipped
/// as well, as they would conflict with the methods.
///
///
///
/// In order to work, needs to be applied to a type that inherits from
/// (either directly or indirectly), or to one decorated with .
/// This is because the methods rely on some of the inherited members to work.
/// If this condition is not met, the code will fail to build.
///
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
public sealed class ObservableRecipientAttribute : Attribute
{
}