package com.inspect.access.base.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

public class RuleModel implements Serializable {
   private static final long serialVersionUID = -621853527262598913L;
   public int nChannel;
   public int nPresetId;
   public int nRuleId;
   public int nMeterType;
   public String szName;
   public int bEnable;
   public List<AccessPointModel> points;
   public float fObjectEmissivity;
   public int nObjectDistance;
   public int nRefalectedTemp;

   public int getnChannel() {
      return this.nChannel;
   }

   public void setnChannel(String nChannel) {
      this.nChannel = Integer.parseInt(nChannel.substring(nChannel.length() - 1));
   }

   public int getnPresetId() {
      return this.nPresetId;
   }

   public void setnPresetId(int nPresetId) {
      this.nPresetId = nPresetId;
   }

   public int getnRuleId() {
      return this.nRuleId;
   }

   public void setnRuleId(int nRuleId) {
      this.nRuleId = nRuleId;
   }

   public int getnMeterType() {
      return this.nMeterType;
   }

   public void setnMeterType(int nMeterType) {
      this.nMeterType = nMeterType;
   }

   public String getSzName() {
      return this.szName;
   }

   public void setSzName(String szName) {
      this.szName = szName;
   }

   public int getbEnable() {
      return this.bEnable;
   }

   public void setbEnable(int bEnable) {
      this.bEnable = bEnable;
   }

   public List<AccessPointModel> getPoints() {
      return this.points;
   }

   public void setPoints(List<AccessPointModel> points) {
      this.points = points;
   }

   public void loadPoints(String coordinates) {
      String[] split = coordinates.split(",");
      this.points = new ArrayList();

      for(int i = 0; i < split.length - 2; i += 2) {
         this.points.add(new AccessPointModel(Integer.parseInt(split[i]) * 8192 / Integer.parseInt(split[split.length - 2]), Integer.parseInt(split[i + 1]) * 8192 / Integer.parseInt(split[split.length - 1])));
      }

   }

   public float getfObjectEmissivity() {
      return this.fObjectEmissivity;
   }

   public void setfObjectEmissivity(float fObjectEmissivity) {
      this.fObjectEmissivity = fObjectEmissivity;
   }

   public int getnObjectDistance() {
      return this.nObjectDistance;
   }

   public void setnObjectDistance(int nObjectDistance) {
      this.nObjectDistance = nObjectDistance;
   }

   public int getnRefalectedTemp() {
      return this.nRefalectedTemp;
   }

   public void setnRefalectedTemp(int nRefalectedTemp) {
      this.nRefalectedTemp = nRefalectedTemp;
   }
}
