<?php


namespace common\services;

use common\models\EmergencyResponseRelateToRulesPoints;
use common\models\EmergencyResponse;

class EmergencyResponseRelateToRulesPointsService
{
    public static function getListByEmergencyResponseId($emergencyResponseId)
    {
        return EmergencyResponseRelateToRulesPoints::find()->where(["and", ["emergency_response_id" => $emergencyResponseId], [">", "rules_point_id", 0]])->all();
    }

    public static function add(EmergencyResponse $EmergencyResponse): void
    {
        RulesPointsRelationshipService::addEmergencyResponseRelationship($EmergencyResponse);
    }

    public static function update(EmergencyResponse $EmergencyResponse): void
    {
        RulesPointsRelationshipService::updateEmergencyResponseRelationship($EmergencyResponse);
    }
    
    public static function deleteByEmergencyResponseId($EmergencyResponseId)
    {
        EmergencyResponseRelateToRulesPoints::deleteAll(["emergency_response_id" => $EmergencyResponseId]);
    }
}