services:
    Akeneo\Pim\Automation\DataQualityInsights\Infrastructure\Clock\SystemClock: ~

    Akeneo\Pim\Automation\DataQualityInsights\Application\Consolidation\ConsolidateProductScores:
        arguments:
            - '@akeneo.pim.automation.data_quality_insights.query.get_product_criteria_evaluations'
            - '@Akeneo\Pim\Automation\DataQualityInsights\Application\Consolidation\ComputeProductScores'
            - '@Akeneo\Pim\Automation\DataQualityInsights\Infrastructure\Persistence\Repository\ProductScoreRepository'
            - '@Akeneo\Pim\Automation\DataQualityInsights\Infrastructure\Clock\SystemClock'

    Akeneo\Pim\Automation\DataQualityInsights\Application\Consolidation\ComputeProductScores:
        arguments:
            - '@Akeneo\Pim\Automation\DataQualityInsights\Infrastructure\Persistence\Query\Structure\CachedGetLocalesByChannelQuery'
            - '@akeneo.pim.automation.data_quality_insights.product_criteria_evaluation_registry'

    Akeneo\Pim\Automation\DataQualityInsights\Application\GetProductScores:
        arguments:
            - '@Akeneo\Pim\Automation\DataQualityInsights\Infrastructure\Persistence\Query\ProductEvaluation\GetUpToDateLatestProductScoresQuery'
            - '@Akeneo\Pim\Automation\DataQualityInsights\Infrastructure\Persistence\Query\Structure\CachedGetLocalesByChannelQuery'

    akeneo.pim.automation.data_quality_insights.get_product_evaluation:
        class: Akeneo\Pim\Automation\DataQualityInsights\Application\GetProductEvaluation
        arguments:
            - '@akeneo.pim.automation.data_quality_insights.query.get_up_to_date_product_criteria_evaluations'
            - '@Akeneo\Pim\Automation\DataQualityInsights\Infrastructure\Persistence\Query\Structure\CachedGetLocalesByChannelQuery'
            - '@akeneo.pim.automation.data_quality_insights.product_criteria_evaluation_registry'
            - '@akeneo.pim.automation.data_quality_insights.product.complete_evaluation_with_improvable_attributes'

    akeneo.pim.automation.data_quality_insights.get_product_model_evaluation:
        class: Akeneo\Pim\Automation\DataQualityInsights\Application\GetProductEvaluation
        arguments:
            - '@akeneo.pim.automation.data_quality_insights.query.get_up_to_date_product_model_criteria_evaluations'
            - '@Akeneo\Pim\Automation\DataQualityInsights\Infrastructure\Persistence\Query\Structure\CachedGetLocalesByChannelQuery'
            - '@akeneo.pim.automation.data_quality_insights.product_model_criteria_evaluation_registry'
            - '@akeneo.pim.automation.data_quality_insights.product_model.complete_evaluation_with_improvable_attributes'

    Akeneo\Pim\Automation\DataQualityInsights\Application\Consolidation\ConsolidateDashboardRates:
        arguments:
            - '@Akeneo\Pim\Automation\DataQualityInsights\Infrastructure\Persistence\Query\Dashboard\GetRanksDistributionFromProductScoresQuery'
            - '@Akeneo\Pim\Automation\DataQualityInsights\Infrastructure\Persistence\Query\Structure\GetAllCategoryCodesQuery'
            - '@Akeneo\Pim\Automation\DataQualityInsights\Infrastructure\Persistence\Query\Structure\GetAllFamilyCodesQuery'
            - '@Akeneo\Pim\Automation\DataQualityInsights\Infrastructure\Persistence\Repository\DashboardScoresProjectionRepository'

    Akeneo\Pim\Automation\DataQualityInsights\Application\Consolidation\PurgeOutdatedData:
        arguments:
            - '@Akeneo\Pim\Automation\DataQualityInsights\Infrastructure\Persistence\Repository\DashboardScoresProjectionRepository'
            - '@Akeneo\Pim\Automation\DataQualityInsights\Infrastructure\Persistence\Repository\ProductScoreRepository'

    akeneo.pim.automation.data_quality_insights.create_products_criteria_evaluations:
        class: Akeneo\Pim\Automation\DataQualityInsights\Application\ProductEvaluation\CreateCriteriaEvaluations
        public: true
        arguments:
            - '@akeneo.pim.automation.data_quality_insights.product_criteria_evaluation_registry'
            - '@akeneo.pim.automation.data_quality_insights.repository.product_criterion_evaluation'

    akeneo.pim.automation.data_quality_insights.create_product_models_criteria_evaluations:
        class: Akeneo\Pim\Automation\DataQualityInsights\Application\ProductEvaluation\CreateCriteriaEvaluations
        public: true
        arguments:
            - '@akeneo.pim.automation.data_quality_insights.product_model_criteria_evaluation_registry'
            - '@akeneo.pim.automation.data_quality_insights.repository.product_model_criterion_evaluation'

    akeneo.pim.automation.data_quality_insights.product_criteria_evaluation_registry:
        class: Akeneo\Pim\Automation\DataQualityInsights\Application\ProductEvaluation\CriteriaEvaluationRegistry
        arguments:
            - !tagged akeneo.pim.automation.data_quality_insights.evaluate_product_criterion

    akeneo.pim.automation.data_quality_insights.product_model_criteria_evaluation_registry:
        class: Akeneo\Pim\Automation\DataQualityInsights\Application\ProductEvaluation\CriteriaEvaluationRegistry
        arguments:
            - !tagged akeneo.pim.automation.data_quality_insights.evaluate_product_model_criterion

    akeneo.pim.automation.data_quality_insights.evaluate_products_pending_criteria:
        class: Akeneo\Pim\Automation\DataQualityInsights\Application\ProductEvaluation\EvaluatePendingCriteria
        arguments:
            - '@akeneo.pim.automation.data_quality_insights.repository.product_criterion_evaluation'
            - '@akeneo.pim.automation.data_quality_insights.product_criteria_evaluation_registry'
            - '@Akeneo\Pim\Automation\DataQualityInsights\Application\ProductEvaluation\CriteriaApplicabilityRegistry'
            - '@akeneo.pim.automation.data_quality_insights.query.get_product_pending_criteria_evaluations'
            - '@akeneo.pim.automation.data_quality_insights.query.get_evaluable_product_values'
            - '@akeneo.pim.automation.data_quality_insights.synchronous_criterion_evaluations_filter'
            - '@logger'

    akeneo.pim.automation.data_quality_insights.evaluate_product_models_pending_criteria:
        class: Akeneo\Pim\Automation\DataQualityInsights\Application\ProductEvaluation\EvaluatePendingCriteria
        arguments:
            - '@akeneo.pim.automation.data_quality_insights.repository.product_model_criterion_evaluation'
            - '@akeneo.pim.automation.data_quality_insights.product_model_criteria_evaluation_registry'
            - '@Akeneo\Pim\Automation\DataQualityInsights\Application\ProductEvaluation\CriteriaApplicabilityRegistry'
            - '@akeneo.pim.automation.data_quality_insights.query.get_product_model_pending_criteria_evaluations'
            - '@akeneo.pim.automation.data_quality_insights.query.get_evaluable_product_model_values'
            - '@akeneo.pim.automation.data_quality_insights.synchronous_criterion_evaluations_filter'
            - '@logger'

    Akeneo\Pim\Automation\DataQualityInsights\Application\ProductEvaluation\CriteriaApplicabilityRegistry:
        arguments:
            - !tagged akeneo.pim.automation.data_quality_insights.evaluate_criterion_applicability

    akeneo.pim.automation.calculate_product_completeness_of_required_attributes:
        class: Akeneo\Pim\Automation\DataQualityInsights\Infrastructure\Enrichment\CalculateProductCompleteness
        arguments:
            - '@Akeneo\Pim\Automation\DataQualityInsights\Infrastructure\Persistence\Query\ProductEnrichment\GetProductIdentifierFromProductIdQuery'
            - '@akeneo.pim.automation.completeness_product_required_attributes_calculator'

    akeneo.pim.automation.calculate_product_completeness_of_non_required_attributes:
        class: Akeneo\Pim\Automation\DataQualityInsights\Infrastructure\Enrichment\CalculateProductCompleteness
        arguments:
            - '@Akeneo\Pim\Automation\DataQualityInsights\Infrastructure\Persistence\Query\ProductEnrichment\GetProductIdentifierFromProductIdQuery'
            - '@akeneo.pim.automation.completeness_product_non_required_attributes_calculator'

    akeneo.pim.automation.calculate_product_image_enrichment:
        class: Akeneo\Pim\Automation\DataQualityInsights\Infrastructure\Enrichment\CalculateProductCompleteness
        arguments:
            - '@Akeneo\Pim\Automation\DataQualityInsights\Infrastructure\Persistence\Query\ProductEnrichment\GetProductIdentifierFromProductIdQuery'
            - '@akeneo.pim.automation.completeness_product_image_enrichment_calculator'

    akeneo.pim.automation.completeness_product_required_attributes_calculator:
        class: Akeneo\Pim\Enrichment\Component\Product\Completeness\CompletenessCalculator
        arguments:
            - '@akeneo.pim.enrichment.completeness.query.get_product_masks'
            - '@Akeneo\Pim\Automation\DataQualityInsights\Infrastructure\Persistence\Query\Completeness\GetRequiredAttributesMasksQuery'

    akeneo.pim.automation.completeness_product_non_required_attributes_calculator:
        class: Akeneo\Pim\Enrichment\Component\Product\Completeness\CompletenessCalculator
        arguments:
            - '@akeneo.pim.enrichment.completeness.query.get_product_masks'
            - '@Akeneo\Pim\Automation\DataQualityInsights\Infrastructure\Persistence\Query\Completeness\GetNonRequiredAttributesMasksQuery'

    akeneo.pim.automation.completeness_product_image_enrichment_calculator:
        class: Akeneo\Pim\Enrichment\Component\Product\Completeness\CompletenessCalculator
        arguments:
            - '@akeneo.pim.enrichment.completeness.query.get_product_masks'
            - '@akeneo.pim.automation.data_quality_insights.query.product.get_enrichment_images_masks'

    akeneo.pim.automation.calculate_product_model_completeness_of_required_attributes:
        class: Akeneo\Pim\Automation\DataQualityInsights\Infrastructure\Enrichment\CalculateProductModelCompleteness
        arguments:
            - '@akeneo.pim.enrichment.completeness.query.get_product_masks'
            - '@Akeneo\Pim\Automation\DataQualityInsights\Infrastructure\Persistence\Query\Completeness\GetRequiredProductModelAttributesMaskQuery'
            - '@pim_catalog.repository.product_model'

    akeneo.pim.automation.calculate_product_model_completeness_of_non_required_attributes:
        class: Akeneo\Pim\Automation\DataQualityInsights\Infrastructure\Enrichment\CalculateProductModelCompleteness
        arguments:
            - '@akeneo.pim.enrichment.completeness.query.get_product_masks'
            - '@Akeneo\Pim\Automation\DataQualityInsights\Infrastructure\Persistence\Query\Completeness\GetNonRequiredProductModelAttributesMaskQuery'
            - '@pim_catalog.repository.product_model'

    akeneo.pim.automation.calculate_product_model_image_enrichment:
        class: Akeneo\Pim\Automation\DataQualityInsights\Infrastructure\Enrichment\CalculateProductModelCompleteness
        arguments:
            - '@akeneo.pim.enrichment.completeness.query.get_product_masks'
            - '@akeneo.pim.automation.data_quality_insights.query.product_model.get_enrichment_images_masks'
            - '@pim_catalog.repository.product_model'

    akeneo.pim.automation.data_quality_insights.mark_product_criteria_to_evaluate:
        class: Akeneo\Pim\Automation\DataQualityInsights\Application\ProductEvaluation\MarkCriteriaToEvaluate
        arguments:
            - '@Akeneo\Pim\Automation\DataQualityInsights\Infrastructure\Elasticsearch\Query\GetUpdatedProductIdsQuery'
            - '@Akeneo\Pim\Automation\DataQualityInsights\Infrastructure\Persistence\Query\ProductEvaluation\GetProductIdsImpactedByAttributeGroupActivationQuery'
            - '@akeneo.pim.automation.data_quality_insights.create_products_criteria_evaluations'

    akeneo.pim.automation.data_quality_insights.mark_product_model_criteria_to_evaluate:
        class: Akeneo\Pim\Automation\DataQualityInsights\Application\ProductEvaluation\MarkCriteriaToEvaluate
        arguments:
            - '@Akeneo\Pim\Automation\DataQualityInsights\Infrastructure\Elasticsearch\Query\GetUpdatedProductModelIdsQuery'
            - '@Akeneo\Pim\Automation\DataQualityInsights\Infrastructure\Persistence\Query\ProductEvaluation\GetProductModelIdsImpactedByAttributeGroupActivationQuery'
            - '@akeneo.pim.automation.data_quality_insights.create_product_models_criteria_evaluations'

    Akeneo\Pim\Automation\DataQualityInsights\Infrastructure\Install\InitializeJobs:
        public: true
        arguments:
            - '@pim_enrich.repository.job_instance'
            - '@database_connection'

    akeneo.pim.automation.data_quality_insights.synchronous_criterion_evaluations_filter:
        class: Akeneo\Pim\Automation\DataQualityInsights\Application\ProductEvaluation\SynchronousCriterionEvaluationsFilter

    Akeneo\Pim\Automation\DataQualityInsights\Application\ComputeProductsKeyIndicators:
        arguments:
            - '@Akeneo\Pim\Automation\DataQualityInsights\Infrastructure\Persistence\Query\Structure\CachedGetLocalesByChannelQuery'
            - !tagged akeneo.pim.automation.data_quality_insights.compute_key_indicator_query

    akeneo.pim.automation.data_quality_insights.get_key_indicators:
        class: Akeneo\Pim\Automation\DataQualityInsights\Application\GetKeyIndicators
        arguments:
            - '@Akeneo\Pim\Automation\DataQualityInsights\Infrastructure\Elasticsearch\Query\GetProductKeyIndicatorsQuery'
            - !php/const Akeneo\Pim\Automation\DataQualityInsights\Domain\Model\KeyIndicator\ProductsWithGoodEnrichment::CODE
            - !php/const Akeneo\Pim\Automation\DataQualityInsights\Domain\Model\KeyIndicator\ProductsWithImage::CODE

    akeneo.pim.automation.data_quality_insights.product.complete_evaluation_with_improvable_attributes:
        class: Akeneo\Pim\Automation\DataQualityInsights\Application\ProductEvaluation\CompleteEvaluationWithImprovableAttributes
        arguments:
            - '@Akeneo\Pim\Automation\DataQualityInsights\Infrastructure\Persistence\Query\Structure\CachedGetLocalesByChannelQuery'
            - '@akeneo.pim.automation.calculate_product_completeness_of_required_attributes'
            - '@akeneo.pim.automation.calculate_product_completeness_of_non_required_attributes'

    akeneo.pim.automation.data_quality_insights.product_model.complete_evaluation_with_improvable_attributes:
        class: Akeneo\Pim\Automation\DataQualityInsights\Application\ProductEvaluation\CompleteEvaluationWithImprovableAttributes
        arguments:
            - '@Akeneo\Pim\Automation\DataQualityInsights\Infrastructure\Persistence\Query\Structure\CachedGetLocalesByChannelQuery'
            - '@akeneo.pim.automation.calculate_product_model_completeness_of_required_attributes'
            - '@akeneo.pim.automation.calculate_product_model_completeness_of_non_required_attributes'
