<?php


namespace common\services;

use common\models\OperationalAdjustmentsRelateToRulesPoints;
use common\models\OperationalAdjustments;

class OperationalAdjustmentsRelateToRulesPointsService
{
    public static function getListByOperationalAdjustmentsId($emergencyResponseId)
    {
        return OperationalAdjustmentsRelateToRulesPoints::find()->where(["and", ["operational_adjustments_id" => $emergencyResponseId], [">", "rules_point_id", 0]])->all();
    }

    public static function add(OperationalAdjustments $OperationalAdjustments): void
    {
        RulesPointsRelationshipService::addOperationalAdjustmentsRelationship($OperationalAdjustments);
    }

    public static function update(OperationalAdjustments $OperationalAdjustments): void
    {
        RulesPointsRelationshipService::updateOperationalAdjustmentsRelationship($OperationalAdjustments);
    }

    public static function deleteByOperationalAdjustmentsId($OperationalAdjustmentsId): void
    {
        OperationalAdjustmentsRelateToRulesPoints::deleteAll(["operational_adjustments_id" => $OperationalAdjustmentsId]);
    }

}