// ============================================================
// CONTRACTS: {{FEATURE_NAME_TITLE}}
// Generated by MORPH Framework
// Date: {{DATE}}
// ============================================================

#region Usings

using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;

#endregion

namespace {{NAMESPACE}}.Application.Features.{{FEATURE_NAME_PASCAL}};

#region Service Interfaces

/// <summary>
/// Service for managing {{FEATURE_NAME_PASCAL}} operations.
/// </summary>
public interface I{{FEATURE_NAME_PASCAL}}Service
{
    /// <summary>
    /// Gets a {{FEATURE_NAME_LOWER_SNAKE}} by its identifier.
    /// </summary>
    Task<{{FEATURE_NAME_PASCAL}}Dto?> GetByIdAsync(int id, CancellationToken cancellationToken = default);

    /// <summary>
    /// Gets all {{FEATURE_NAME_LOWER_SNAKE}}s.
    /// </summary>
    Task<List<{{FEATURE_NAME_PASCAL}}Dto>> GetAllAsync(CancellationToken cancellationToken = default);

    /// <summary>
    /// Creates a new {{FEATURE_NAME_LOWER_SNAKE}}.
    /// </summary>
    Task<{{FEATURE_NAME_PASCAL}}Dto> CreateAsync(Create{{FEATURE_NAME_PASCAL}}Request request, CancellationToken cancellationToken = default);

    /// <summary>
    /// Updates an existing {{FEATURE_NAME_LOWER_SNAKE}}.
    /// </summary>
    Task UpdateAsync(int id, Update{{FEATURE_NAME_PASCAL}}Request request, CancellationToken cancellationToken = default);

    /// <summary>
    /// Deletes a {{FEATURE_NAME_LOWER_SNAKE}}.
    /// </summary>
    Task DeleteAsync(int id, CancellationToken cancellationToken = default);
}

#endregion

#region DTOs

/// <summary>
/// Data transfer object for {{FEATURE_NAME_PASCAL}}.
/// </summary>
public record {{FEATURE_NAME_PASCAL}}Dto(
    int Id,
    string Name,
    {{FEATURE_NAME_PASCAL}}Status Status,
    DateTime CreatedAt,
    DateTime? UpdatedAt
);

/// <summary>
/// Request to create a new {{FEATURE_NAME_PASCAL}}.
/// </summary>
public record Create{{FEATURE_NAME_PASCAL}}Request(
    string Name
    // Add other required fields
);

/// <summary>
/// Request to update an existing {{FEATURE_NAME_PASCAL}}.
/// </summary>
public record Update{{FEATURE_NAME_PASCAL}}Request(
    string Name
    // Add other updatable fields
);

#endregion

#region Enums

/// <summary>
/// Status of a {{FEATURE_NAME_PASCAL}}.
/// </summary>
public enum {{FEATURE_NAME_PASCAL}}Status
{
    Pending = 0,
    Active = 1,
    Completed = 2,
    Failed = 3
}

#endregion

#region Repository Interfaces

/// <summary>
/// Repository for {{FEATURE_NAME_PASCAL}} data access.
/// </summary>
public interface I{{FEATURE_NAME_PASCAL}}Repository
{
    Task<{{FEATURE_NAME_PASCAL}}?> GetByIdAsync(int id, CancellationToken cancellationToken = default);
    Task<List<{{FEATURE_NAME_PASCAL}}>> GetAllAsync(CancellationToken cancellationToken = default);
    Task AddAsync({{FEATURE_NAME_PASCAL}} entity, CancellationToken cancellationToken = default);
    void Update({{FEATURE_NAME_PASCAL}} entity);
    void Remove({{FEATURE_NAME_PASCAL}} entity);
    Task SaveChangesAsync(CancellationToken cancellationToken = default);
}

#endregion

#region Domain Entity Reference

/*
/// <summary>
/// {{FEATURE_NAME_PASCAL}} domain entity.
/// Implement in Domain/Entities/{{FEATURE_NAME_PASCAL}}.cs
/// </summary>
public class {{FEATURE_NAME_PASCAL}}
{
    public int Id { get; private set; }
    public string Name { get; private set; } = string.Empty;
    public {{FEATURE_NAME_PASCAL}}Status Status { get; private set; }
    public DateTime CreatedAt { get; private set; }
    public DateTime? UpdatedAt { get; private set; }

    private {{FEATURE_NAME_PASCAL}}() { } // EF Constructor

    public static {{FEATURE_NAME_PASCAL}} Create(string name)
    {
        return new {{FEATURE_NAME_PASCAL}}
        {
            Name = name,
            Status = {{FEATURE_NAME_PASCAL}}Status.Pending,
            CreatedAt = DateTime.UtcNow
        };
    }

    public void Activate()
    {
        Status = {{FEATURE_NAME_PASCAL}}Status.Active;
        UpdatedAt = DateTime.UtcNow;
    }

    public void Complete()
    {
        Status = {{FEATURE_NAME_PASCAL}}Status.Completed;
        UpdatedAt = DateTime.UtcNow;
    }
}
*/

#endregion

#region AI Agent Interfaces (if applicable)

/// <summary>
/// AI Agent for {{FEATURE_NAME_PASCAL}} analysis.
/// </summary>
public interface I{{FEATURE_NAME_PASCAL}}AnalyzerAgent
{
    /// <summary>
    /// Analyzes {{FEATURE_NAME_LOWER_SNAKE}} data using AI.
    /// </summary>
    Task<{{FEATURE_NAME_PASCAL}}AnalysisResult> AnalyzeAsync(
        {{FEATURE_NAME_PASCAL}}Data data,
        CancellationToken cancellationToken = default);
}

public record {{FEATURE_NAME_PASCAL}}Data(
    // Input data for analysis
    string Content
);

public record {{FEATURE_NAME_PASCAL}}AnalysisResult(
    string Summary,
    List<string> Insights,
    List<string> Recommendations,
    double ConfidenceScore
);

#endregion

#region Hangfire Job Interfaces (if applicable)

/// <summary>
/// Background job for processing {{FEATURE_NAME_PASCAL}}.
/// </summary>
public interface I{{FEATURE_NAME_PASCAL}}ProcessorJob
{
    /// <summary>
    /// Executes the {{FEATURE_NAME_LOWER_SNAKE}} processing job.
    /// </summary>
    Task ExecuteAsync(int id, CancellationToken cancellationToken = default);
}

#endregion

#region Exceptions

public class {{FEATURE_NAME_PASCAL}}NotFoundException : Exception
{
    public {{FEATURE_NAME_PASCAL}}NotFoundException(int id)
        : base($"{{FEATURE_NAME_PASCAL}} with ID {id} was not found.") { }
}

public class {{FEATURE_NAME_PASCAL}}ProcessingException : Exception
{
    public {{FEATURE_NAME_PASCAL}}ProcessingException(string message, Exception? innerException = null)
        : base(message, innerException) { }
}

#endregion
