<?php

namespace Application\Service\Extension\Helper;

use Application\Service\DB\Dictionary\Form;
use Application\Service\Extension\Laminas;

class LogicHelper
{
    protected ?int $contentPrimaryKey = null;

    protected string $closeMessage = '';

    /**
     * 设置content主键
     * @param int $primaryKey
     */
    public function setContentPrimaryKey(int $primaryKey)
    {
        $this->contentPrimaryKey = $primaryKey;
    }

    public function setCloseMessage(string $message): LogicHelper
    {
        $this->closeMessage = $message;
        return $this;
    }

    public static function closeError($errorId)
    {
        // 删除质疑
        Laminas::$serviceManager->itemPatientFormLogicError->update(['is_closed' => 1], ['id' => $errorId]);
        Laminas::$serviceManager->itemPatientFormLogicErrorLog->update(['is_closed' => 1], ['error_id' => $errorId]);
        // Laminas::$serviceManager->itemPatientFormLogicErrorPointer->update(['is_del' => 1], ['error_id' => $errorId]);
    }

    public function setQuery(string $content, $errorId, int $itemId,$pointer_id)
    {
        if (is_array($errorId)) {
            foreach ($errorId as $item) {
                Laminas::$serviceManager->itemPatientFormLogicErrorQuery->save([
                    'content' => $content,
                    'error_id' => $item,
                    'platform' => 2,
                    'is_reply' => 1,
                    'pointer_id' => $item,
                    'item_id' => $itemId,
                    'create_user_id' => 0 // 系统
                ]);
            }
        } else {
            Laminas::$serviceManager->itemPatientFormLogicErrorQuery->save([
                'content' => $content,
                'error_id' => $errorId,
                'platform' => 1,
                'is_reply' => 1,
                'pointer_id' => $pointer_id,
                'item_id' => $itemId,
                'create_user_id' => 0 // 系统
            ]);
        }
    }

    /**
     * Notes: 发送指标未查质疑信息
     * User: llbjj
     * DateTime: 2024/9/20 10:24
     * desc: 指标未查质疑 error、pointer、log 表中只能存在一条，未查的指标质疑的沟通记录都存在query表中
     *
     * @param string $fieldProp 指标质疑字段
     * @param int $primaryKey
     * @param string $message 指标对应的质疑消息
     *
     * @throws \Exception
     */
    public function setReportError(string $fieldProp, int $primaryKey, string $message = '') {
        // 查询指标是否是否为未查指标（is_identification = 1）
        $resultChangeData = Laminas::$serviceManager->itemIdentificationresultchange->fetchOne([
            'where' => ['id' => $primaryKey, 'is_identification' => 1]
        ]);

        if(empty($resultChangeData)) return ;

        $errorId = Laminas::$serviceManager->itemPatientFormLogicError->getOneFieldVal('id', [
            'is_report' => 1,
            'multi_id' => $primaryKey
        ], ['id' => 'desc']);


        $time = time();
        if(!$errorId) {
            // 质疑主表单
            $errorId = Laminas::$serviceManager->itemPatientFormLogicError->isSetInfo(false)->save([
                'expression_note' => $message,
                'create_user_id' => 0,
                'create_time' => $time,
                'item_id' => &$resultChangeData['item_id'],
                'checktime_id' => &$resultChangeData['checktime_id'],
                'patient_id' => &$resultChangeData['patient_id'],
                'multi_id' => $primaryKey,
                'is_closed' => 0,
                'is_queried' => 1,
                'sign_id' => &$resultChangeData['itemsig_id'],
                'is_reply' => 0,
                'error_type' => 0,
                'form_id' => &$resultChangeData['form_id'],
                'is_ae' => 0,
                'is_report' => 1,
                'is_report_special' => 0,
                'formcontent_id' => &$resultChangeData['patientformcontent_id'],
            ]);
            Laminas::$serviceManager->itemPatientFormLogicError->isSetInfo(false)->update(['expression_id' => $errorId], ['id' => $errorId]);

            // 质疑子表单
            $pointer_id = Laminas::$serviceManager->itemPatientFormLogicErrorPointer->isSetInfo(false)->save([
                'checktime_id' => &$resultChangeData['checktime_id'],
                'form_id' => &$resultChangeData['form_id'],
                'create_user_id' => 0,
                'create_time' => $time,
                'patient_id' => &$resultChangeData['patient_id'],
                'item_id' => &$resultChangeData['item_id'],
                'error_id' => $errorId,
                'prop' => $fieldProp,
                'error_message' => $message,
                'multi_id' => $primaryKey,
                'is_reply' => 0,
                'error_type' => 0,
                'is_report' => 1
            ]);

            // 统计记录
            Laminas::$serviceManager->itemPatientFormLogicErrorLog->save([
                'error_id' => $errorId,
                'is_error' => 0,
                'item_id' => &$resultChangeData['item_id'],
                'sign_id' => &$resultChangeData['itemsig_id'],
                'patient_id' => &$resultChangeData['patient_id'],
                'form_id' => &$resultChangeData['form_id'],
                'checktime_id' => &$resultChangeData['checktime_id'],
                'error_type' => 0,
                'role' => 2,
                'is_process' => SDMHelper::app()->form->getIsProcess($resultChangeData['form_id'])
            ]);

            // 记录质疑的沟通记录
            Laminas::$serviceManager->itemPatientFormLogicErrorQuery->save([
                'content' => $message,
                'error_id' => $errorId,
                'platform' => 1,
                'is_reply' => 0,
                'pointer_id' => $pointer_id,
                'item_id' => &$resultChangeData['item_id'],
                'create_user_id' => 0 // 系统
            ]);

        }else {
            $pointer_id = Laminas::$serviceManager->itemPatientFormLogicErrorPointer->getOneFieldVal('id', [
                'error_id' => $errorId,
                'multi_id' => $primaryKey,
                'is_report' => 1
            ], ['id' => 'desc']);

            if(!$pointer_id) {
                // 新增质疑子表单
                $pointer_id = Laminas::$serviceManager->itemPatientFormLogicErrorPointer->isSetInfo(false)->save([
                    'checktime_id' => &$resultChangeData['checktime_id'],
                    'form_id' => &$resultChangeData['form_id'],
                    'create_user_id' => 0,
                    'create_time' => $time,
                    'patient_id' => &$resultChangeData['patient_id'],
                    'item_id' => &$resultChangeData['item_id'],
                    'error_id' => $errorId,
                    'prop' => $fieldProp,
                    'error_message' => $message,
                    'multi_id' => $primaryKey,
                    'is_reply' => 0,
                    'error_type' => 0,
                    'is_report' => 1
                ]);
            }else {
                /*Laminas::$serviceManager->itemPatientFormLogicErrorPointer->isSetInfo(false)->update([
                    'create_time' => $time
                ], [
                    'id' => $pointer_id
                ]);*/
            }

            Laminas::$serviceManager->itemPatientFormLogicError->isSetInfo(false)->update(['is_closed' => 0, 'error_type' => 0, 'is_del' => 0], ['id' => $errorId]);
            Laminas::$serviceManager->itemPatientFormLogicErrorPointer->isSetInfo(false)->update(['is_del' => 0 ], ['id' => $pointer_id]);
            Laminas::$serviceManager->itemPatientFormLogicErrorLog->update([
                'is_closed' => 0,
                'is_process' => SDMHelper::app()->form->getIsProcess($resultChangeData['form_id'])
            ], ['error_id' => $errorId]);
        }

        // 记录质疑的沟通记录
        /*Laminas::$serviceManager->itemPatientFormLogicErrorQuery->save([
            'content' => $message,
            'error_id' => $errorId,
            'platform' => 1,
            'is_reply' => 0,
            'pointer_id' => $pointer_id,
            'item_id' => &$resultChangeData['item_id'],
            'create_user_id' => 0 // 系统
        ]);*/
    }

    /**
     * 发送质疑
     */
    public function setError($fieldId, int $primaryKey = null, $message = '')
    {
        if (!$this->contentPrimaryKey) {
            $this->contentPrimaryKey = $primaryKey;
        }

        $content = Laminas::$serviceManager->patientFormContent->fetchOne([
            'where' => ['id' => $primaryKey]
        ]);

        $itemId = $content['item_id'] ?? 0;
        $signId = $content['itemsig_id'] ?? 0;
        $checktimeId = $content['checktime_id'] ?? 0;
        $formId = $content['form_id'] ?? 0;
        $patientId = $content['patient_id'] ?? 0;

        $time = time();
        $errorId = Laminas::$serviceManager->itemPatientFormLogicError->isSetInfo(false)->save([
            'expression_note' => $message,
            'create_user_id' => 0,
            'create_time' => $time,
            'item_id' => $itemId,
            'checktime_id' => $checktimeId,
            'patient_id' => $patientId,
            'multi_id' => $primaryKey,
            'is_closed' => 0,
            'is_queried' => 1,
            'sign_id' => $signId,
            'is_reply' => 0,
            'error_type' => 0,
            'form_id' => $formId,
            'is_ae' => 0,
            'is_report' => 0,
            'is_report_special' => 0,
            'submit_role' => '',
            'expression_id' => 0,
        ]);
        $pointerId = Laminas::$serviceManager->itemPatientFormLogicErrorPointer->isSetInfo(false)->save([
            'checktime_id' => $checktimeId,
            'form_id' => $formId,
            'create_time' => $time,
            'create_user_id' => 0,
            'patient_id' => $patientId,
            'item_id' => $itemId,
            'error_id' => $errorId,
            'prop' => $fieldId,
            'error_message' => $message,
            'multi_id' => $this->contentPrimaryKey,
            'is_reply' => 0,
            'error_type' => 1,
        ]);

        /*aminas::$serviceManager->itemConfirm->closeconfirm(
            $itemId,
            $patientId,
            $checktimeId,
            $formId,
            SDMHelper::app()->form->getGroupId($formId) == Form::FORM_TYPE_MULTI ? 1 : 0,
            $this->contentPrimaryKey ?: 0
        );*/

        Laminas::$serviceManager->itemPatientFormLogicErrorLog->save([
            'error_id' => $errorId,
            'is_error' => 0,
            'item_id' => $itemId,
            'sign_id' => $signId,
            'patient_id' => $patientId,
            'form_id' => $formId,
            'checktime_id' => $checktimeId,
            'error_type' => 1,
            'role' => 2,
            'is_process' => SDMHelper::app()->form->getIsProcess($formId)
        ]);

        Laminas::$serviceManager->itemPatientFormLogicErrorQuery->save([
            'content' => $message,
            'error_id' => $errorId,
            'platform' => Laminas::$serviceManager->itemPatientFormLogicErrorQuery::PLATFORM_EDC,
            'is_reply' => 0,
            'pointer_id' => $pointerId,
            'item_id' => $itemId,
            'create_user_id' => 0 // 系统
        ]);
    }

    /**
     * Notes: 更新指标所有未关闭的质疑的状态
     * User: llbjj
     * DateTime: 2024/10/18 20:38
     * desc: 解锁操作：更新所有未关闭的指标质疑的is_closed=1, is_lock = 1;
     *       锁定操作：更新所有锁定的已关闭的质疑
     *                  1、未查质疑如果数据已补充，则自动解锁并关闭质疑  is_closed = 1, is_lock = 0
     *                  2、手动质疑，打开并解锁质疑 is_closed = 0，is_lock= 0
     *
     * @param int $patientId
     * @param int $checktimeId
     * @param int $formId
     * @param int $itemId
     * @param int $oprtLock 【 0、解锁操作；1、锁定操作 】
     * @param int $isRestock 是否补充数据【 0、否；1、是 】
     */
    public static function upReportErrorStatus(int $patientId, int $checktimeId, int $formId, int $itemId, int $oprtLock = 0, int $isRestock = 0) {
        $errorList = Laminas::$serviceManager->itemPatientFormLogicError->fetchAll([
            'where' => [
                'is_closed' => $isRestock ? 0 : $oprtLock,
                'is_lock' =>  $isRestock ? 0 : $oprtLock,
                'patient_id' => $patientId,
                'form_id' => $formId,
                'item_id' => $itemId,
                'checktime_id' => $checktimeId,
            ],
            'columns' => ['id', 'error_type', 'multi_id', 'item_id']
        ]);

        //化验单锁定关闭原表单质疑


        if(!empty($errorList)) {
            foreach($errorList as &$error) {
                $pointerId = Laminas::$serviceManager->itemPatientFormLogicErrorPointer->getOneFieldVal('id', [
                    'error_id' => $error['id'],
                    'is_report' => 1
                ], ['id' => 'desc']);

                if(!$oprtLock) {
                    //解锁指标-向query里面追加解锁记录
                    Laminas::$serviceManager->itemPatientFormLogicErrorQuery->save([
                        'content' => '化验单数据解锁更新',
                        'error_id' => $error['id'],
                        'platform' => 2,
                        'is_reply' => 0,
                        'is_auditor' => 1,
                        'pointer_id' => $pointerId,
                        'item_id' => $error['item_id']
                    ]);
                }

                $isClosed = self::_getUpReportErrorFieldVal('is_closed', $oprtLock, $error);
                $isLock = self::_getUpReportErrorFieldVal('is_lock', $oprtLock, $error);
                Laminas::$serviceManager->itemPatientFormLogicError->update([
                    'is_closed' => $isClosed, // 是否关闭
                    'is_lock' => $isLock, // 是否锁定
                ], ['id' => $error['id']]);

                // 更新errorLog
                Laminas::$serviceManager->itemPatientFormLogicErrorLog->update([
                    'is_closed' => $isClosed
                ], [ 'error_id' => $error['id'] ]);

                if($isClosed && !$isLock) {
                    // 向query中添加关闭质疑的记录
                    Laminas::$serviceManager->itemPatientFormLogicErrorQuery->save([
                        'content' => '关闭质疑',
                        'error_id' => $error['id'],
                        'platform' => 1,
                        'is_reply' => 1,
                        'pointer_id' => $pointerId,
                        'item_id' => $error['item_id'],
                        'create_user_id' => 0 // 系统
                    ]);
                }
            }
        }
    }

    /**
     * Notes: 关闭指标所有质疑
     *
     * @param int $patientId
     * @param int $checktimeId
     * @param int $formId
     * @param int $itemId
     * @param string $message
     * @param int $errorLock 当前质疑的状态
     */
    public static function closeAllReportError(int $patientId, int $checktimeId, int $formId, int $itemId, $message = '数据已更新')
    {
        // 查询所有的
        $childError = Laminas::$serviceManager->itemPatientFormLogicErrorPointer->fetchAll([
            'where' => [
                'patient_id' => $patientId,
                'checktime_id' => $checktimeId,
                'form_id' => $formId,
                'is_del' => 0,
                'is_report' => 1,
            ]
        ]) ?: [];

        if(!empty($childError)) {
            // 获取已查的数据
            foreach ($childError as $item) {
                if($message != '') Laminas::$serviceManager->itemPatientFormLogicErrorQuery->save([
                    'content' => $message,
                    'error_id' => $item['error_id'],
                    'platform' => 1,
                    'is_reply' => 1,
                    'pointer_id' => $item['id'],
                    'item_id' => $itemId,
                    'create_user_id' => 0 // 系统
                ]);

                self::closeError($item['error_id']);

                if(Laminas::$serviceManager->itemPatientFormLogicError->getOneFieldVal('is_report', [
                    'id' => $item['error_id'],
                ])){
                    // 化验单指标未查质疑，在指标数据补充完整后( is_identification = 0 )，系统自动关闭
                    if(!Laminas::$serviceManager->itemIdentificationresultchange->getOneFieldVal('is_identification', [
                        'id' => $item['multi_id'],
                    ])) {
                        Laminas::$serviceManager->itemPatientFormLogicError->upDelState([
                            'id' => $item['error_id']
                        ], 0);
                        Laminas::$serviceManager->itemPatientFormLogicErrorPointer->upDelState([
                            'id' => $item['id'],
                        ], 0);

                        // 已关闭的系统自动追加的 关闭质疑 记录
                        Laminas::$serviceManager->itemPatientFormLogicErrorQuery->save([
                            'content' => '关闭质疑',
                            'error_id' => $item['error_id'],
                            'platform' => 1,
                            'is_reply' => 1,
                            'pointer_id' => $item['id'],
                            'item_id' => $itemId,
                            'create_user_id' => 0 // 系统
                        ]);
                    }
                }
            }
        }
    }


    /**
     * Notes : 化验单锁定关闭原表单质疑非指标质疑  但是不关闭指标质疑
     * @param int $patientId
     * @param int $checktimeId
     * @param int $formId
     * @param int $itemId
     * @param string $message
     * Author:唐伯虎不虎
     * Date:2024/12/19 9:29
     */
    public static function closeformError(int $patientId, int $checktimeId, int $formId, int $itemId, $message = '数据已更新')
    {
        // 查询所有的
        $childError = Laminas::$serviceManager->itemPatientFormLogicErrorPointer->fetchAll([
            'where' => [
                'patient_id' => $patientId,
                'checktime_id' => $checktimeId,
                'form_id' => $formId,
                'is_del' => 0,
            ]
        ]) ?: [];

        $close_where = [
            'item_id' => $itemId,
            'patient_id' => $patientId,
            'checktime_id' => $checktimeId,
            'form_id' => $formId,
            'is_closed' => 1,
        ];
        //查询关闭质疑的ID
        $close_ids = Laminas::$serviceManager->itemPatientFormLogicError->fetchCol('id',$close_where);

        if(!empty($childError)) {
            // 获取已查的数据
            foreach ($childError as $item) {
                //原来未关闭的 非指标质疑才关闭 并 增加一个数据已更新 的自动回复记录
                if(empty($item['is_report']) && (is_numeric($item['prop']) || $item['prop'] == 'sdtx') && !in_array($item['error_id'],$close_ids)){
                    Laminas::$serviceManager->itemPatientFormLogicErrorQuery->save([
                        'content' => '数据已更新',
                        'error_id' => $item['error_id'],
                        'platform' => 1,
                        'is_reply' => 1,
                        'pointer_id' => $item['id'],
                        'item_id' => $itemId,
                        'create_user_id' => 0 // 系统
                    ]);
                    self::closeError($item['error_id']);
                }
                if($message != '' && !in_array($item['error_id'],$close_ids)) Laminas::$serviceManager->itemPatientFormLogicErrorQuery->save([
                    'content' => $message,
                    'error_id' => $item['error_id'],
                    'platform' => 2,
                    'is_reply' => 0,
                    'is_auditor' => 1,
                    'pointer_id' => $item['id'],
                    'item_id' => $itemId,
                    'create_user_id' => Laminas::$serviceManager->identity->getId()
                ]);
            }
        }
    }

    /**
     *
     */
    public function closeRowError(int $contentId, int $itemId)
    {
        if (EdcHelper::isEdc(SDMHelper::app()->item->getFid($itemId))) {
            $errors = Laminas::$serviceManager->itemPatientFormLogicError->fetchAll([
                'where' => [
                    'multi_id' => $contentId,
                    'is_del' => 0
                ]
            ]);

            foreach ($errors as $error) {
                $pointer_id = Laminas::$serviceManager->itemPatientFormLogicErrorPointer->getOneFieldVal('id',[
                    'error_id' => $error['id'],
                    'is_del' => 0,
                ]);
                $this->setQuery($this->closeMessage ?: '数据已移除', $error['id'], $itemId,$pointer_id);
                self::closeError($error['id']);
            }
        }
    }

    /**
     * 通过质疑id来关闭指定的质疑, 并且带上回复
     */
    public function closeErrorByErrorId(int $errorId, string $message)
    {
        $childError = Laminas::$serviceManager->itemPatientFormLogicErrorPointer->fetchAll([
            'where' => [
                'error_id' => $errorId,
                'is_del' => 0
            ]
        ]) ?: [];

        if(!empty($childError)) {
            // 获取已查的数据
            foreach ($childError as $item) {
                Laminas::$serviceManager->itemPatientFormLogicErrorQuery->save([
                    'content' => $message,
                    'error_id' => $item['error_id'],
                    'platform' => 1,
                    'is_reply' => 1,
                    'pointer_id' => $item['id'],
                    'item_id' => $item['item_id'],
                    'create_user_id' => 0 // 系统
                ]);

                self::closeError($item['error_id']);
            }
        }
    }


    /**
     * Notes:常规识别数据解锁更新 关闭所有质疑未关闭的质疑 保存更新记录
     * @param
     * @return
     * @author haojinhua
     * @date 2025-03-21 09:14
     */
    public function newcloseRowError(int $contentId, int $itemId)
    {
        if (EdcHelper::isEdc(SDMHelper::app()->item->getFid($itemId))) {
            $errors = Laminas::$serviceManager->itemPatientFormLogicError->fetchAll([
                'where' => [
                    'multi_id' => $contentId,
                    'is_closed' => 0,
                    'is_del' => 0
                ]
            ]);

            if(!empty($errors)){
                foreach ($errors as &$error) {
                    $pointerId = Laminas::$serviceManager->itemPatientFormLogicErrorPointer->getOneFieldVal('id', [
                        'error_id' => $error['id'],
                        'multi_id' => $error['multi_id'],
                    ], ['id' => 'desc']);

                    Laminas::$serviceManager->itemPatientFormLogicError->update([
                        'is_closed' => 1, // 是否关闭
                        'is_lock' => 1,   //这里反用一下这个字段  因为之前已经关闭过的质疑这里不处理 所以之前已经关闭的质疑is_lock 还是0，这里解锁处理的改成1，标志是解锁关闭的质疑
                    ], ['id' => $error['id']]);

                    // 更新errorLog
                    Laminas::$serviceManager->itemPatientFormLogicErrorLog->update([
                        'is_closed' => 1,
                    ], [ 'error_id' => $error['id'] ]);

                    //入一条解锁更新的沟通记录 并关闭质疑
                    if(empty($error['is_closed'])){
                        Laminas::$serviceManager->itemPatientFormLogicErrorQuery->save([
                            'content' => $this->closeMessage ?: '常规识别数据解锁更新',
                            'error_id' => $error['id'],
                            'platform' => 2,
                            'is_reply' => 0,
                            'is_auditor' => 1,
                            'pointer_id' => $pointerId,
                            'item_id' => $itemId,
                            'create_user_id' =>Laminas::$serviceManager->identity->getId()
                        ]);
                        self::closeError($error['id']);
                    }

                }
            }

        }
    }

    /**
     * Notes:常规识别数据锁定更新
     * @param
     * @return
     * @author haojinhua
     * @date 2025-03-21
     */
    public function newopenRowError(int $formId, int $patientId, int $checktimeId, int $itemId){
        $errorList = Laminas::$serviceManager->itemPatientFormLogicError->fetchAll([
            'where' => [
                'is_closed' => 1,
                'is_lock'   => 1,
                'patient_id' => $patientId,
                'form_id' => $formId,
                'item_id' => $itemId,
                'checktime_id' => $checktimeId,
            ],
            'columns' => ['id', 'multi_id', 'item_id']
        ]);
        if(!empty($errorList)) {
            foreach($errorList as &$error) {
                //处理那些解锁关闭掉的质疑
                $pointerId = Laminas::$serviceManager->itemPatientFormLogicErrorPointer->getOneFieldVal('id', [
                    'error_id' => $error['id'],
                    'multi_id' => $error['multi_id'],
                ], ['id' => 'desc']);

                //重新打开质疑 并且插入更新锁定的沟通记录
                Laminas::$serviceManager->itemPatientFormLogicError->update([
                    'is_closed' => 0, // 是否关闭
                    'is_lock' => 0,
                ], ['id' => $error['id']]);

                // 更新errorLog
                Laminas::$serviceManager->itemPatientFormLogicErrorLog->update([
                    'is_closed' => 0
                ], [ 'error_id' => $error['id'] ]);

                Laminas::$serviceManager->itemPatientFormLogicErrorQuery->save([
                    'content' => '常规识别数据更新锁定',
                    'error_id' => $error['id'],
                    'platform' => 2,
                    'is_reply' => 0,
                    'is_auditor' => 1,
                    'pointer_id' => $pointerId,
                    'item_id' => $error['item_id'],
                    'create_user_id' =>Laminas::$serviceManager->identity->getId()
                ]);
            }
        }
    }



    /**
     * Notes: 获取要更新质疑的指定字段的值
     * User: llbjj
     * DateTime: 2024/10/18 21:28
     *
     * @param string $field
     * @param int $oprtLock
     * @param array $error
     * @return int
     */
    private static function _getUpReportErrorFieldVal(string $field, int $oprtLock = 0, array &$error): int
    {
        // error_type: 0、系统质疑；1、手动质疑   oprtLock: 0、解锁操作；1、锁定操作
        if($error['error_type'] || $field != 'is_closed') return $oprtLock ? 0 : 1;

        // 系统自动质疑[未查] is_identification = 1
        return $oprtLock && Laminas::$serviceManager->itemIdentificationresultchange->getOneFieldVal('is_identification', [
            'id' => $error['multi_id'],
            ]) ? 0 : 1;
    }

}