<commit_before>﻿using Anabi.Domain.Asset.Commands;
using MediatR;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;

namespace Anabi.Domain.Asset
{
    public class AddSolutionHandler : BaseHandler
        , IAsyncRequestHandler<AddSolution, int>
    {
        public AddSolutionHandler(BaseHandlerNeeds needs) : base(needs)
        {
        }

        public async Task<int> Handle(AddSolution message)
        {
            throw new NotImplementedException();
        }
    }
}<commit_msg>Handler<commit_after>﻿using Anabi.DataAccess.Ef.DbModels;
using Anabi.Domain.Asset.Commands;
using MediatR;
using System.Threading.Tasks;

namespace Anabi.Domain.Asset
{
    public class AddSolutionHandler : BaseHandler
        , IAsyncRequestHandler<AddSolution, int>
    {
        public AddSolutionHandler(BaseHandlerNeeds needs) : base(needs)
        {
        }

        public async Task<int> Handle(AddSolution message)
        {

            var newStage = new HistoricalStageDb
            {
                AssetId = message.AssetId,
                StageId = message.StageId,
                DecizieId = message.DecisionId,
                InstitutionId = message.InstitutionId,
                DecisionDate = message.DecisionDate,
                DecisionNumber = message.DecisionNumber,
                RecoveryBeneficiaryId = message.RecoveryBeneficiaryId,
            };
            
            newStage.ActualValue = message.RecoveryDetails?.ActualValue;
            newStage.EstimatedAmount = message.RecoveryDetails?.EstimatedAmount;
            newStage.EstimatedAmountCurrency = message.RecoveryDetails?.EstimatedAmountCurrency;
            newStage.ActualValueCurrency = message.RecoveryDetails?.ActualValueCurrency;
            newStage.RecoveryState = message.RecoveryDetails?.RecoveryState;

            newStage.EvaluationCommittee = message.RecoveryDetails?.EvaluationCommittee?.EvaluationCommitteeMembers;
            newStage.EvaluationCommitteePresident = message.RecoveryDetails?.EvaluationCommittee?.EvaluationCommitteePresident;
            newStage.EvaluationCommitteeDesignationDate = message.RecoveryDetails?.EvaluationCommittee?.EvaluationCommitteeDesignationDate;

            newStage.RecoveryCommittee = message.RecoveryDetails?.RecoveryCommittee?.RecoveryCommitteeMembers;
            newStage.RecoveryCommitteePresident = message.RecoveryDetails?.RecoveryCommittee?.RecoveryCommitteePresident;
            newStage.RecoveryCommitteeDesignationDate = message.RecoveryDetails?.RecoveryCommittee?.RecoveryCommitteeDesignationDate;

            newStage.LastActivity = message.RecoveryDetails?.LastActivity;
            newStage.PersonResponsible = message.RecoveryDetails?.PersonResponsible;

            newStage.Source = message.SolutionDetails?.Source;
            newStage.SentOnEmail = message.SolutionDetails?.SentOnEmail;
            newStage.FileNumber = message.SolutionDetails?.FileNumber;
            newStage.FileNumberParquet = message.SolutionDetails?.FileNumberParquet;
            newStage.ReceivingDate = message.SolutionDetails?.ReceivingDate;
            newStage.IsDefinitive = message.SolutionDetails?.IsDefinitive;
            newStage.DefinitiveDate = message.SolutionDetails?.DefinitiveDate;
            newStage.SendToAuthoritiesDate = message.SolutionDetails?.SentToAuthoritiesDate;
            newStage.CrimeTypeId = message.SolutionDetails?.CrimeTypeId;
            newStage.LegalBasis = message.SolutionDetails?.LegalBasis;

            context.HistoricalStages.Add(newStage);
            await context.SaveChangesAsync();

            return newStage.Id;
        }
    }
}
{'fraction_non_alphanumeric': 0.07362129856017387, 'fraction_numerical': 0.0, 'mean_word_length': 3.0108932461873636, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '7579969', 'n_tokens_mistral': 961, 'n_tokens_neox': 911, 'n_words': 126}