<commit_before>﻿using Optivem.Core.Domain;
using System.Linq;
using System.Threading.Tasks;

namespace Optivem.Core.Application
{
    class FindAllUseCase<TRequest, TResponse, TRecordResponse, TEntity, TId> : IFindAllUseCase<TRequest, TResponse>
        where TRequest : IFindAllRequest
        where TResponse : IFindAllResponse<TRecordResponse>, new()
        where TRecordResponse : IFindAllRecordResponse
        where TEntity : class, IEntity<TId>
    {
        public FindAllUseCase(IResponseMapper responseMapper, IReadonlyRepository<TEntity, TId> repository)
        {
            ResponseMapper = responseMapper;
            Repository = repository;
        }

        protected IResponseMapper ResponseMapper { get; private set; }

        protected IReadonlyRepository<TEntity, TId> Repository { get; private set; }

        public async Task<TResponse> HandleAsync(TRequest request)
        {
            // TODO: VC: Later handling use case with pagination, need corresponding dto and also result not just list
<commit_msg>#195 Application Use Cases<commit_after>﻿using Optivem.Core.Domain;
using System.Linq;
using System.Threading.Tasks;

namespace Optivem.Core.Application
{
    public class FindAllUseCase<TRequest, TResponse, TRecordResponse, TEntity, TId> : IFindAllUseCase<TRequest, TResponse>
        where TRequest : IFindAllRequest
        where TResponse : IFindAllResponse<TRecordResponse>, new()
        where TRecordResponse : IFindAllRecordResponse
        where TEntity : class, IEntity<TId>
    {
        public FindAllUseCase(IResponseMapper responseMapper, IReadonlyRepository<TEntity, TId> repository)
        {
            ResponseMapper = responseMapper;
            Repository = repository;
        }

        protected IResponseMapper ResponseMapper { get; private set; }

        protected IReadonlyRepository<TEntity, TId> Repository { get; private set; }

        public async Task<TResponse> HandleAsync(TRequest request)
        {
            // TODO: VC: Later handling use case with pagination, need corresponding dto and also result not just list

{'fraction_non_alphanumeric': 0.06835564053537285, 'fraction_numerical': 0.0014340344168260039, 'mean_word_length': 3.3695198329853864, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7051571', 'n_tokens_mistral': 559, 'n_tokens_neox': 549, 'n_words': 154}