package com.inspect.ivs.vo;

import com.inspect.base.core.utils.StringUtils;

import java.io.Serializable;
import java.util.Objects;

public class IvsVo implements Serializable {
   private static final long serialVersionUID = -6922254609485688648L;
   private String code;
   private String cameraCode;
   private String domainCode;
   private String name;
   private String id;
   private String host;
   private String port;
   private String username;
   private String password;
   private String address;
   private String UUID;

   public void setCode(String code) {
      if(!StringUtils.isEmpty(code)) {
         this.code = code;
         String[] splits = this.code.split("\\#");
         if(splits.length == 1) {
            this.cameraCode = splits[0];
            this.domainCode = splits[0];
         } else {
            this.cameraCode = splits[0];
            this.domainCode = splits[1];
         }
      }
   }

   public String getCode() {
      return this.code;
   }

   public String getCameraCode() {
      return this.cameraCode;
   }

   public String getDomainCode() {
      return this.domainCode;
   }

   public void setCameraCode(String cameraCode) {
      this.cameraCode = cameraCode;
   }

   public void setDomainCode(String domainCode) {
      this.domainCode = domainCode;
   }

   public String getHost() {
      return host;
   }

   public void setHost(String host) {
      this.host = host;
   }

   public String getPort() {
      return port;
   }

   public void setPort(String port) {
      this.port = port;
   }

   public String getUsername() {
      return username;
   }

   public void setUsername(String username) {
      this.username = username;
   }

   public String getPassword() {
      return password;
   }

   public void setPassword(String password) {
      this.password = password;
   }

   public String getAddress() {
      return address;
   }

   public void setAddress(String address) {
      this.address = address;
   }

   public String getName() {
      return name;
   }

   public void setName(String name) {
      this.name = name;
   }

   public String getId() {
      return id;
   }

   public void setId(String id) {
      this.id = id;
   }

   public String getUUID() {
      return UUID;
   }

   public void setUUID(String UUID) {
      this.UUID = UUID;
   }

   @Override
   public boolean equals(Object object) {
      if (this == object) return true;
      if (object == null || getClass() != object.getClass()) return false;
      IvsVo ivsVo = (IvsVo) object;
      return Objects.equals(code, ivsVo.code) && Objects.equals(cameraCode, ivsVo.cameraCode) && Objects.equals(domainCode, ivsVo.domainCode) && Objects.equals(host, ivsVo.host) && Objects.equals(port, ivsVo.port) && Objects.equals(username, ivsVo.username) && Objects.equals(password, ivsVo.password) && Objects.equals(address, ivsVo.address);
   }

   @Override
   public int hashCode() {
      return Objects.hash(code, cameraCode, domainCode, host, port, username, password, address);
   }

   @Override
   public String toString() {
      return "IvsVo{" +
              "code='" + code + '\'' +
              ", cameraCode='" + cameraCode + '\'' +
              ", domainCode='" + domainCode + '\'' +
              ", host='" + host + '\'' +
              ", port='" + port + '\'' +
              ", username='" + username + '\'' +
              ", password='" + password + '\'' +
              ", address='" + address + '\'' +
              '}';
   }
}
