import { Component, OnInit, ViewChild } from "@angular/core";
import { ActivatedRoute, Router } from "@angular/router";
import {
  FormBuilder,
  Validators,
  FormGroup,
  FormControl,
} from "@angular/forms";

import { MainService } from "../../services/main.service";
import { OverlayScrollbarsComponent } from "overlayscrollbars-ngx";
import { ToolService } from "../../services/tool.service";
import { Subject } from "rxjs";
import { debounceTime } from "rxjs/operators";
import { NzMessageService } from "ng-zorro-antd";
import { format } from "date-fns";
@Component({
  selector: "app-round-robin",
  templateUrl: "./round-robin.component.html",
  styleUrls: ["./round-robin.component.less"],
})
export class RoundRobinComponent implements OnInit {
  @ViewChild("osComponentRef1", {
    read: OverlayScrollbarsComponent,
    static: false,
  })
  osComponentRef1: OverlayScrollbarsComponent;
  constructor(
    private message: NzMessageService,
    private fb: FormBuilder,
    private mainService: MainService,
    private route: ActivatedRoute,
    private router: Router,
    private tool: ToolService
  ) {}

  userInfo: any = JSON.parse(localStorage.getItem("user")) || {}; //登录用户信息

  searchCriteria = {
    //搜索条件
    name: "",
    hospital: null,
    endDepartment: null,
  };
  roundRobinTypes = []; //轮巡类型
  timeSteps = [
    // { id: "381", name: "每天轮巡" },
    { key: "day", name: "每天" },
    { key: "week", name: "每周" },
    { key: "month", name: "每月" },
    { key: "year", name: "每年" },
  ]; //轮巡类型
  createUser = "";
  dayType = ["全部", "节假日", "工作日"]; //执行策略里的复选框数据字典
  department = []; // 院区下的科室列表
  departmentSearch = []; // 院区下的科室列表(搜索框)
  allHospital: any = []; //院区下拉框
  listOfData: any[] = []; //表格数据
  pageIndex: number = 1; //表格当前页码
  pageSize: number = 10; //表格每页展示条数
  listLength: number = 10; //表格总数据量
  tableHeight: number; //表格动态高
  modal: boolean = false; //新增/编辑模态框
  add: boolean; //true:新增；false:编辑
  validateForm: FormGroup; //新增/编辑表单
  coopId: number; //当前操作列id

  hospitalList: Array<object> = []; //院区列表
  hosId: any; //当前院区id
  oneOption: any; //适用日期类型
  btnLoading: boolean = false; //提交按钮loading状态

  promptContent: string; //操作提示框提示信息
  ifSuccess: boolean; //操作成功/失败
  promptInfo: string; //操作结果提示信息
  promptModalShow: boolean; //操作提示框是否展示
  demoValue: number = 0;
  changeInpSubject = new Subject();
  changeInpTasktypeSubject = new Subject();
  ngOnInit() {
    this.changeInpSubject.pipe(debounceTime(500)).subscribe((v) => {
      this.searchDepartment(v[0], v[1]);
    });
    this.changeInpTasktypeSubject
      .pipe(debounceTime(500))
      .subscribe((v: any) => {
        this.getTasktypeByIds(v);
      });
    this.coopBtns = this.tool.initCoopBtns(this.route);
    this.getAllHospital();
    this.initForm();
    this.getHospitalList();
  }
  // 重置
  reset() {
    this.searchCriteria = {
      //搜索条件
      name: "",
      hospital: this.allHospital[0] ? this.allHospital[0]["id"] + "" : null,
      endDepartment: null,
    };
    this.getList(1);
  }
  // 选择院区
  changeHospital(id, type) {
    if (type === "search") {
      this.searchCriteria.endDepartment = null;
    } else {
      if (
        this.validateForm &&
        this.validateForm.value &&
        this.validateForm.value.endDepartment
      ) {
        this.validateForm.controls.endDepartment.setValue(null);
      }
    }
    let data = {
      department: {
        hospital: { id },
        type: { id: 383 },
      },
      idx: 0,
      sum: 20,
    };
    this.mainService
      .getFetchDataList("data", "department", data)
      .subscribe((data) => {
        if (data.status == 200) {
          if (type === "search") {
            this.departmentSearch = data.list;
          } else {
            this.department = data.list;
          }
        }
      });
  }
  // 打开搜索框
  changeSearch(flag) {
    if (flag) {
      this.changeInp("no", "search");
    }
  }
  changeForm(flag) {
    if (flag) {
      this.changeInp("no", "form");
    }
  }
  changeFormTasktype(flag) {
    if (flag) {
      this.changeInpTasktype();
    }
  }
  changeFormEnd(flag) {
    if (flag) {
      this.changeInp("no", "formEnd");
    }
  }
  // 选择轮巡类型
  selectedTasktype = null; //当前选中的轮巡类型
  selectedTasktypeHandler(e) {
    this.selectedTasktype = this.roundRobinTypes.find((item) => item.id == e);
    this.requiredChange(
      this.selectedTasktype.associationType.value == "specimenPlan",
      "endDepartment"
    );
    console.log(this.selectedTasktype);
  }
  // 任务类型防抖搜索
  changeInpTasktype(taskName = "") {
    this.isLoading = true;
    this.changeInpTasktypeSubject.next(taskName);
  }
  // 边输边搜节流阀
  isLoading = false;
  changeInp(dept, type) {
    if (dept === "no") {
      dept = "";
    }
    if (type === "form") {
      if (!this.hosId) {
        this.department = [];
        return;
      }
    }
    this.isLoading = true;
    this.changeInpSubject.next([dept, type]);
  }
  // 搜索科室
  depting = "";
  searchDepartment(dept, type) {
    this.depting = dept;
		let postData={
			department: {
				dept,
				hospital: { id: this.hosId },
				cascadeHosId: this.hosId,
				type: { id: null },
			},
			idx: 0,
			sum: 5,
		}
		if(this.selectedTasktype.associationType.value == "specimen"){
			postData.department.type.id = 282
			delete postData.department.hospital
		}else{
			postData.department.type.id = 383
			delete postData.department.cascadeHosId
		}
    this.mainService
      .getFetchDataList("data", "department", postData)
      .subscribe((result) => {
        if (result.status == 200) {
          if (type === "search" && this.depting === postData.department.dept) {
            this.isLoading = false;
            this.departmentSearch = result.list;
          } else if (
            type === "form" &&
            this.depting === postData.department.dept
          ) {
            this.isLoading = false;
            this.department = result.list;
          }
        }
      });
  }

  // 初始化增删改按钮
  coopBtns: any = {};

  // 获取所有院区
  /**
   *
   *
   * @memberof RoundRobinComponent
   */
  getAllHospital() {
    this.allHospital = [this.tool.getCurrentHospital()];
    this.searchCriteria.hospital = this.tool.getCurrentHospital().id + "";
    this.getList(1);
    this.changeHospital(this.searchCriteria.hospital, "search");
  }

  // 表格数据
  loading1 = false;
  getList(type) {
    if (type == 1) {
      this.pageIndex = 1;
    }
    let data = {
      idx: this.pageIndex - 1,
      sum: this.pageSize,
      orderPlan: {
        hospital: this.searchCriteria.hospital,
        targetDept:
          this.searchCriteria.endDepartment === null
            ? ""
            : this.searchCriteria.endDepartment,
        title:
          this.searchCriteria.name === null ? "" : this.searchCriteria.name,
      },
    };
    this.loading1 = true;
    this.mainService
      .getFetchDataList("configuration", "orderPlan", data)
      .subscribe((data) => {
        this.loading1 = false;
        if (data.status == 200) {
          this.listOfData = data.list;
          this.listLength = data.totalNum;
          this.listOfData.forEach((item) => {
            if (item.timeStep == "week") {
              let weeks = [
                "周一",
                "周二",
                "周三",
                "周四",
                "周五",
                "周六",
                "周日",
              ];
              item.weekName = weeks[item.extra1 - 1];
            }
          });
        }
      });
  }
  //获取任务类型-标本检查和其他临床服务
  taskNameing = "";
  getTasktypeByIds(taskName = "") {
    this.taskNameing = taskName;
    let postData = {
      idx: 0,
      sum: 5,
      taskType: {
        hosIds: this.hosId + "",
        associationTypeIds: "380,259,256",
        taskName,
      },
    };
    this.mainService
      .getFetchDataList("configuration", "taskType", postData)
      .subscribe((result) => {
        if (
          result.status == 200 &&
          this.taskNameing === postData.taskType.taskName
        ) {
          this.isLoading = false;
          this.roundRobinTypes = result.list;
        }
      });
  }
  // 新增/编辑弹框
  addModal() {
    this.add = true; //新增
    this.modal = true;
		this.selectedTasktype = null;
    this.initForm();
  }
  //关闭新增/编辑弹框
  hideAddModal() {
    this.modal = false;
    this.initForm();
  }
  // 是否是必选
  requiredChange(required: boolean, formControlName: string): void {
    if (!required) {
      this.validateForm.get(formControlName)!.clearValidators();
      this.validateForm.get(formControlName)!.markAsPristine();
    } else {
      this.validateForm
        .get(formControlName)!
        .setValidators(Validators.required);
      this.validateForm.get(formControlName)!.markAsDirty();
    }
    this.validateForm.get(formControlName)!.updateValueAndValidity();
  }
  // 初始化新增form表单
  initForm() {
    this.createUser = this.userInfo.user.name ? this.userInfo.user.name : "";
    this.oneOption = [
      { label: "工作日", value: "工作日", checked: false },
      { label: "节假日", value: "节假日", checked: false },
    ];
    this.validateForm = this.fb.group({
      roundRobinName: [null, [Validators.required]],
      roundRobinType: [null, [Validators.required]],
      timeStep: [null, [Validators.required]],
      datesType: [null, [this.dateValidator]],
      executeTime: [null, [Validators.required]],
      // executionTime: [null, [Validators.required]],
      // time: [null],
      endDepartment: [null, [Validators.required]],
      openDepartments: [false],
    });
    this.validateForm.controls.timeStep.setValue(this.timeSteps[0].key);
    this.timeSelectedValue = [];
  }
  // 修改轮巡策略
  months = [...Array(32).keys()].slice(1);
  timeStepChange(e) {
    switch (e) {
      case "day":
        this.validateForm.removeControl("doWeek");
        this.validateForm.removeControl("doMonth");
        this.validateForm.removeControl("doYear");
        break;
      case "week":
        this.validateForm.addControl(
          "doWeek",
          new FormControl(null, Validators.required)
        );
        this.validateForm.removeControl("doMonth");
        this.validateForm.removeControl("doYear");
        break;
      case "month":
        this.validateForm.addControl(
          "doMonth",
          new FormControl(null, Validators.required)
        );
        this.validateForm.removeControl("doWeek");
        this.validateForm.removeControl("doYear");
        break;
      case "year":
        this.validateForm.addControl(
          "doYear",
          new FormControl(null, Validators.required)
        );
        this.validateForm.removeControl("doWeek");
        this.validateForm.removeControl("doMonth");
        break;
    }
  }

  //创建自定义校验规则dateValidator，用于复选框组校验时调用。
  selectedDate: any = [];
  dateValidator = (control: FormControl): { [s: string]: boolean } => {
    this.selectedDate = [];
    for (const i in control.value) {
      if (control.value[i].checked) {
        this.selectedDate.push(control.value[i]);
      }
    }
    if (this.selectedDate.length == 0) {
      return { required: true };
    }
  };

  // 新增/编辑表单提交
  submitForm(): void {
    this.btnLoading = true;
    for (const i in this.validateForm.controls) {
      this.validateForm.controls[i].markAsDirty();
      this.validateForm.controls[i].updateValueAndValidity();
    }
    if (this.selectedDate) {
      var arr = [];
      this.validateForm.value.datesType.forEach((e) => {
        if (e.checked) {
          arr.push(e.label);
        }
      });
      if (arr.length == 2) {
        this.validateForm.value.datesType = 0;
      } else {
        if (arr[0] == "工作日") {
          this.validateForm.value.datesType = 2;
        } else {
          this.validateForm.value.datesType = 1;
        }
      }
    }
    if (this.validateForm.invalid) {
      this.btnLoading = false;
      return;
    }
    let postData: any = {};

    if (this.add) {
      //增加
      postData = {
        orderPlan: {
          title: this.validateForm.value.roundRobinName,
          hospital: this.hosId,
          taskType: { id: this.validateForm.value.roundRobinType },
          timeStep: this.validateForm.value.timeStep,
          dayType: this.validateForm.value.datesType,
          executeTime: new Date(this.validateForm.value.executeTime).getTime(),
        },
      };
      if (this.selectedTasktype.associationType.value == "specimenPlan"||
					this.selectedTasktype.associationType.value == "specimen") {
        //标本轮巡
        postData.orderPlan.targetDept =
          this.validateForm.value.endDepartment.join();
      } else if (this.selectedTasktype.associationType.value == "other") {
        //其他配送
        postData.orderPlan.taskTypeDeptOrder =
          this.validateForm.value.openDepartments;
      }
      if (this.validateForm.value.timeStep == "day") {
        delete postData.orderPlan.extra1;
      } else if (this.validateForm.value.timeStep == "week") {
        postData.orderPlan.extra1 = this.validateForm.value.doWeek;
      } else if (this.validateForm.value.timeStep == "month") {
        postData.orderPlan.extra1 = this.validateForm.value.doMonth;
      } else if (this.validateForm.value.timeStep == "year") {
        delete postData.orderPlan.extra1;
        postData.orderPlan.executeTime = new Date(
          format(new Date(this.validateForm.value.doYear), "yyyy-MM-dd") +
            " " +
            format(new Date(this.validateForm.value.executeTime), "HH:mm:ss")
        ).getTime();
      }
    } else {
      //编辑
      postData = {
        id: this.coopId,
        title: this.validateForm.value.roundRobinName,
        hospital: this.hosId,
        taskType: { id: this.validateForm.value.roundRobinType },
        timeStep: this.validateForm.value.timeStep,
        dayType: this.validateForm.value.datesType,
        executeTime: new Date(this.validateForm.value.executeTime).getTime(),
      };
      if (this.selectedTasktype.associationType.value == "specimenPlan"||
				this.selectedTasktype.associationType.value == "specimen") {
        //标本轮巡
        postData.targetDept = this.validateForm.value.endDepartment.join();
      } else if (this.selectedTasktype.associationType.value == "other") {
        //其他配送
        postData.taskTypeDeptOrder = this.validateForm.value.openDepartments;
      }
      if (this.validateForm.value.timeStep == "day") {
        delete postData.extra1;
      } else if (this.validateForm.value.timeStep == "week") {
        postData.extra1 = this.validateForm.value.doWeek;
      } else if (this.validateForm.value.timeStep == "month") {
        postData.extra1 = this.validateForm.value.doMonth;
      } else if (this.validateForm.value.timeStep == "year") {
        delete postData.extra1;
        postData.executeTime = new Date(
          format(new Date(this.validateForm.value.doYear), "yyyy-MM-dd") +
            " " +
            format(new Date(this.validateForm.value.executeTime), "HH:mm:ss")
        ).getTime();
      }
    }
    console.log(postData);
    // return; //baba
    this.mainService
      .addRoundRobin(this.add ? "addPlan" : "updatePlan", postData)
      .subscribe((data) => {
        this.btnLoading = false;
        this.hideAddModal();
        this.initForm();
        if (data.status == 200) {
          this.listLength++;
          this.showPromptModal(this.add ? "新增" : "修改", true, "");
        } else {
          this.showPromptModal(this.add ? "新增" : "修改", false, data.msg);
        }
      });
  }

  // 编辑
  executionTimeTemporaryStorage; //暂存执行时间
  maskFlag: any = false;
  maskFlagLoading1 = false;
  maskFlagLoading2 = false;
  edit(data) {
    this.requiredChange(
      data.taskType.associationType.value == "specimenPlan",
      "endDepartment"
    );
    this.maskFlag = this.message.loading("正在加载中..", {
      nzDuration: 0,
    }).messageId;
    this.maskFlagLoading1 = true;
    this.maskFlagLoading2 = true;
    this.add = false;
    this.coopId = data.id;
    this.createUser = data.createUser ? data.createUser.name : ""; //创建人
    this.validateForm.controls.roundRobinName.setValue(data.title); //名称
    // 轮巡类型 start
    {
      this.selectedTasktype = data.taskType;
      let postData = {
        idx: 0,
        sum: 5,
        taskType: {
          hosIds: this.hosId + "",
          associationTypeIds: "380,259,256",
          taskName: "",
        },
      };
      this.mainService
        .getFetchDataList("configuration", "taskType", postData)
        .subscribe((result) => {
          this.maskFlagLoading1 = false;
          if (!this.maskFlagLoading1 && !this.maskFlagLoading2) {
            this.message.remove(this.maskFlag);
            this.maskFlag = false;
            this.modal = true;
          }
          if (result.status == 200) {
            this.roundRobinTypes = result.list;
            let flag = this.roundRobinTypes.some(
              (item) => item.id == data.taskType.id
            );
            if (!flag) {
              this.roundRobinTypes.unshift(data.taskType);
            }
            this.validateForm.controls.roundRobinType.setValue(
              data.taskType.id
            ); //轮巡类型
          }
        });
    }
    // 轮巡类型end
    this.validateForm.controls.timeStep.setValue(data.timeStep); //轮巡策略
    this.validateForm.controls.executeTime.setValue(new Date(data.executeTime)); //轮巡策略
    this.defaultSelectTimesOption = data.executeTime;
    //轮巡策略(时间) start
    this.timeStepChange(data.timeStep);
    if (data.timeStep == "year") {
      this.validateForm.controls.doYear.setValue(
        format(data.executeTime, "yyyy-MM-dd HH:mm:ss")
      );
    } else if (data.timeStep == "month") {
      this.validateForm.controls.doMonth.setValue(data.extra1);
    } else if (data.timeStep == "week") {
      this.validateForm.controls.doWeek.setValue(data.extra1);
    }
    //轮巡策略（时间）end
    // --------终点科室---
    if (data.taskType.associationType.value == "specimenPlan" ||
			this.selectedTasktype.associationType.value == "specimen") {
      //标本轮巡，则回显
      let targetDeptArr = [];
      let targetDept = data.targetDept.split(",");
      let targetDeptShow = data.targetDeptShow.split(",");
      targetDept.forEach((item, index) => {
        targetDeptArr.push({ id: item, dept: targetDeptShow[index] });
      });
			let query={
				department: {
					hospital: { id: data.hospital },
					cascadeHosId:data.hospital,
					type: { id: null },
				},
				idx: 0,
				sum: 20,
			}
			if(this.selectedTasktype.associationType.value == "specimen"){
				query.department.type.id = 282
				delete query.department.hospital
			}else{
				query.department.type.id = 383
				delete query.department.cascadeHosId
			}
      this.mainService
        .getFetchDataList("data", "department", query)
        .subscribe((data) => {
          this.maskFlagLoading2 = false;
          if (!this.maskFlagLoading1 && !this.maskFlagLoading2) {
            this.message.remove(this.maskFlag);
            this.maskFlag = false;
            this.modal = true;
          }
          if (data.status == 200) {
            let add = targetDeptArr.filter(
              (item) => !data.list.some((ele) => ele.id == item.id)
            );
            this.department = add.concat(data.list);
            this.validateForm.controls.endDepartment.setValue(targetDept);
          }
        });
    } else {
      this.maskFlagLoading2 = false;
      if (!this.maskFlagLoading1 && !this.maskFlagLoading2) {
        this.message.remove(this.maskFlag);
        this.maskFlag = false;
        this.modal = true;
      }
    }
    // --------/终点科室---
    if (
      data.taskType.associationType.value == "other" &&
      (data.taskType.carryingCourses[0].departmentStrategy.value == 1 ||
        data.taskType.carryingCourses[1].departmentStrategy.value == 1)
    ) {
      this.validateForm.controls.openDepartments.setValue(
        data.taskTypeDeptOrder
      );
    }
    if (data.dayType == 1) {
      //节假日
      this.oneOption[1]["checked"] = true;
    } else if (data.dayType == 2) {
      //工作日
      this.oneOption[0]["checked"] = true;
    } else {
      this.oneOption[0]["checked"] = true;
      this.oneOption[1]["checked"] = true;
    }
  }
  // 立即执行
  coopItem: any = {};
  execModal: boolean = false;
  // 打开立即执行模态框
  openExecModal(item) {
    this.coopItem = item;
    this.execModal = true;
  }
  // 确认立即执行
  confirmExec() {
    this.btnLoading = true;
    this.mainService
      .executeNowOrderPlan(this.coopItem.id)
      .subscribe((result: any) => {
        this.closeExecModal();
        this.btnLoading = false;
        if (result.status == 200) {
          this.showPromptModal("立即执行", true, "");
        } else {
          this.showPromptModal("立即执行", false, result.msg);
        }
      });
  }
  // 关闭立即执行模态框
  closeExecModal() {
    this.execModal = false;
  }
  // 展示信息提示框（con:提示信息，success:操作是否成功，promptInfo:操作结果提示信息）
  showPromptModal(con, success, promptInfo?) {
    this.promptModalShow = false;
    this.promptContent = con;
    this.ifSuccess = success;
    this.promptInfo = promptInfo;
    setTimeout(() => {
      this.promptModalShow = true;
    }, 100);
    this.getList(0);
  }

  // 删除轮巡计划
  delModal: boolean = false; //删除模态框
  tipsMsg1: string; //提示框信息
  tipsMsg2: string; //操作后信息
  confirmDelType: string; //确认的类型（启用/停用，删除）
  confirmDelIsSwitch: boolean; //启用/停用
  showDelModal(
    id: number,
    tipsMsg1: string,
    tipsMsg2: string,
    type: string,
    isSwitch?: boolean
  ) {
    this.confirmDelIsSwitch = isSwitch;
    this.confirmDelType = type;
    this.delModal = true;
    this.coopId = id;
    this.tipsMsg1 = tipsMsg1;
    this.tipsMsg2 = tipsMsg2;
  }
  // 隐藏删除框
  hideDelModal() {
    this.delModal = false;
  }
  // 确认删除
  confirmDel() {
    this.btnLoading = true;
    if (this.confirmDelType === "del") {
      //删除
      this.mainService.delRoundRobin(this.coopId).subscribe((data) => {
        this.btnLoading = false;
        this.delModal = false;
        if (data.status == 200) {
          console.log(this.pageIndex, this.listLength, this.pageSize, "lmm");
          if (
            this.listOfData.length == 1 &&
            this.pageIndex == Math.ceil(this.listLength / this.pageSize)
          ) {
            this.listLength--;
            if (this.listLength === 0) {
              this.pageIndex = 1;
            } else {
              this.pageIndex = Math.ceil(this.listLength / this.pageSize);
            }
          }
          this.showPromptModal(this.tipsMsg2, true, "");
        } else {
          this.showPromptModal(this.tipsMsg2, false, data.msg);
        }
      });
    } else if (this.confirmDelType === "switch") {
      //启用/停用
      this.mainService
        .switchRoundRobin(
          this.confirmDelIsSwitch ? "stop" : "active",
          this.coopId
        )
        .subscribe((data) => {
          this.btnLoading = false;
          this.delModal = false;
          if (data.status == 200) {
            this.showPromptModal(this.tipsMsg2, true, "");
          } else {
            this.showPromptModal(this.tipsMsg2, false, data.msg);
          }
        });
    }
  }

  // 院区列表
  getHospitalList() {
    this.hospitalList = [this.tool.getCurrentHospital()];
    this.hosId = this.tool.getCurrentHospital().id;
  }
  // 查看
  detail(id) {
    this.router.navigateByUrl("/main/roundRobin/roundRobinDetail/" + id);
  }
  //时间选择框相关
  timeSelectedValue = [];
  defaultSelectTimesOption = [];

  time: Date | null = null;
  defaultTimePickerOpenValue = new Date();
  timePickerOpen = false;
  timeSelectFocus() {
    this.timePickerOpen = true;
  }
  timePickerClick() {
    this.timePickerOpen = false;
    this.time = this.time || new Date();
    let hour = (this.time.getHours() + "").padStart(2, "0");
    let minute = (this.time.getMinutes() + "").padStart(2, "0");
    let str = `${hour}:${minute}`;
    if (!this.timeSelectedValue.includes(str)) {
      this.defaultSelectTimesOption.push(str);
      this.timeSelectedValue.push(str);
    }
  }
  timePickerChange() {
    if (this.timePickerOpen) {
      this.timePickerOpen = false;
    }
  }
  // -----------------------------------------------------------------------
  // 批量建单设置
  batchOrdersFlag = false; //批量建单设置的弹窗
  selectedBatchOrder = null; //当前选中的轮巡计划
  //打开批量建单设置弹窗
  batchOrdersHandler(data) {
    this.batchOrdersFlag = true;
    this.selectedBatchOrder = data;
  }
  //关闭批量建单设置弹窗
  close() {
    this.batchOrdersFlag = false;
  }
}
