<commit_before>﻿using SFA.DAS.EmployerFinance.Configuration;
using SFA.DAS.HashingService;
using SFA.DAS.ObsoleteHashing;
using StructureMap;

namespace SFA.DAS.EmployerFinance.DependencyResolution
{
    public class HashingRegistry : Registry
    {
        public HashingRegistry()
        {
            For<IHashingService>().Use(c => GetHashingService(c));
            For<IPublicHashingService>().Use(c => GetPublicHashingservice(c));
        }

        private IHashingService GetHashingService(IContext context)
        {
            var config = context.GetInstance<EmployerFinanceConfiguration>();
            var hashingService = new HashingService.HashingService(config.AllowedHashstringCharacters, config.Hashstring);

            return hashingService;
        }

        private IPublicHashingService GetPublicHashingservice(IContext context)
        {
            var config = context.GetInstance<EmployerFinanceConfiguration>();
            var publicHashingService = new PublicHashingService(config.PublicAllowedHashstringCharacters, config.PublicHashstring);

            return publicHashingService;
        }
    }
}<commit_msg>AML-3615: change dependency registration to use 'local' marker interfaces.<commit_after>﻿using System;
using SFA.DAS.EmployerFinance.Configuration;
using SFA.DAS.HashingService;
using StructureMap;
using IPublicHashingService = SFA.DAS.EmployerFinance.MarkerInterfaces.IPublicHashingService;

namespace SFA.DAS.EmployerFinance.DependencyResolution
{
    public class HashingRegistry : Registry
    {
        public HashingRegistry()
        {
            For<IHashingService>()
                .Use(
                    c =>
                        new HashingService.HashingService(
                            c.GetInstance<EmployerFinanceConfiguration>()
                                .AllowedHashstringCharacters,
                            c.GetInstance<EmployerFinanceConfiguration>()
                                .Hashstring));

            For<IPublicHashingService>()
                .Use<MarkerInterfaceWrapper>()
                .Ctor<IHashingService>()
                .Is(
                    c =>
                        new HashingService.HashingService(
                            c.GetInstance<EmployerFinanceConfiguration>()
                                .PublicAllowedHashstringCharacters,
                            c.GetInstance<EmployerFinanceConfiguration>()
                                .PublicHashstring)
                );
        }
    }

    class MarkerInterfaceWrapper
    :IPublicHashingService
    {
        private readonly IHashingService _hashingServiceWithCorrectValuesForMarkerInterface;

        public MarkerInterfaceWrapper(IHashingService hashingServiceWithCorrectValuesForMarkerInterface)
        {
            _hashingServiceWithCorrectValuesForMarkerInterface = hashingServiceWithCorrectValuesForMarkerInterface;
        }

        public string HashValue(long id)
        {
            return _hashingServiceWithCorrectValuesForMarkerInterface.HashValue(id);
        }

        public string HashValue(Guid id)
        {
            return _hashingServiceWithCorrectValuesForMarkerInterface.HashValue(id);
        }

        public string HashValue(string id)
        {
            return _hashingServiceWithCorrectValuesForMarkerInterface.HashValue(id);
        }

        public long DecodeValue(string id)
        {
            return _hashingServiceWithCorrectValuesForMarkerInterface.DecodeValue(id);
        }

        public Guid DecodeValueToGuid(string id)
        {
            return _hashingServiceWithCorrectValuesForMarkerInterface.DecodeValueToGuid(id);
        }

        public string DecodeValueToString(string id)
        {
            return _hashingServiceWithCorrectValuesForMarkerInterface.DecodeValueToString(id);
        }

        public bool TryDecodeValue(string input, out long output)
        {
            return _hashingServiceWithCorrectValuesForMarkerInterface.TryDecodeValue(
                input,
                out output);
        }
    }
}
{'fraction_non_alphanumeric': 0.06266829865361077, 'fraction_numerical': 0.0009791921664626683, 'mean_word_length': 2.2351543942992875, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 19, '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': '6816707', 'n_tokens_mistral': 1026, 'n_tokens_neox': 964, 'n_words': 155}