<?php

require_once(rootDir() . 'modules/pmsi/php/etudes/cardioInterventionnelle/Mention.php');
require_once(rootDir() . 'modules/pmsi/php/etudes/cardioInterventionnelle/Modalite.php');
require_once(rootDir() . 'modules/pmsi/php/etudes/cardioInterventionnelle/FamilleActes.php');
require_once(rootDir() . 'modules/pmsi/php/etudes/cardioInterventionnelle/cdc2022/AbstractCardio.php');


class Congenitale extends AbstractCardio
{

    protected $modalite;

    public function __construct()
    {
        parent::__construct();
        $this->modalite = new Modalite("CONG", "Cardiopathie congénitales hors rythmologie");
    }


    public function checkCdcIsValid($year)
    {

        //40 actes thérapeutiques relatifs à la prise en charge de cardiopathie congénitale
        $mentionA = new Mention($this->modalite, "A");
        $nbActesTotal = 0;

        $nbActesMentionA = $mentionA->getNbActes($this->iCTI_connexion, $year);
        $nbActesTotal += $nbActesMentionA;
        if ($nbActesMentionA >= 40) {
            $mentionA->setCdcIsValid(true);
        }

        $this->insertEtudeIsValid($mentionA, $year);

        //80 actes thérapeutiques relatifs à la prise en charge de cardiopathie congénitale
        $mentionB = new Mention($this->modalite, "B");
        $nbActesMentionB = $mentionA->getNbActes($this->iCTI_connexion, $year);
        $nbActesTotal += $nbActesMentionB;

        if ($nbActesTotal >= 80) {
            $mentionB->setCdcIsValid(true);
        }

        $this->insertEtudeIsValid($mentionB, $year);


    }
}