using Elsa.Common.Features;
using Elsa.Expressions.Features;
using Elsa.Extensions;
using Elsa.Features.Abstractions;
using Elsa.Features.Attributes;
using Elsa.Features.Services;
using Elsa.Python.Contracts;
using Elsa.Python.HostedServices;
using Elsa.Python.Options;
using Elsa.Python.Providers;
using Elsa.Python.Services;
using Microsoft.Extensions.DependencyInjection;
namespace Elsa.Python.Features;
///
/// Installs Python integration.
///
[DependsOn(typeof(MediatorFeature))]
[DependsOn(typeof(ExpressionsFeature))]
public class PythonFeature : FeatureBase
{
///
public PythonFeature(IModule module) : base(module)
{
}
///
/// Configures the .
///
public Action PythonOptions { get; set; } = _ => { };
///
public override void ConfigureHostedServices()
{
Module.ConfigureHostedService();
}
///
public override void Apply()
{
Services.Configure(PythonOptions);
// Python services.
Services
.AddScoped()
.AddExpressionDescriptorProvider()
;
// Handlers.
Services.AddNotificationHandlersFrom();
// Activities.
Module.AddActivitiesFrom();
}
}