package com.inspect.ivs.domain;

import com.inspect.ivs.controller.IvsStreamController;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class ZlmConvertUrl {
   private static final Logger log = LoggerFactory.getLogger(ZlmConvertUrl.class);
   private String flv;
   private String m3u8;
   private String mp4;
   private String webrtc;
   private String hls;

   public ZlmConvertUrl(String baseAddress, String webrtcPrefix, String streamId) {
      log.info("baseAddress: {}, webrtcPrefix: {}, streamId: {}", baseAddress, webrtcPrefix, streamId);
      this.flv = String.format("%s/live/%s.live.flv", baseAddress, streamId);
      this.m3u8 = String.format("%s/live/%s.m3u8", baseAddress, streamId);
      this.mp4 = String.format("%s/live/%s.live.mp4", baseAddress, streamId);
      this.webrtc = String.format("%s/index/api/webrtc?app=live&stream=%s&type=play", webrtcPrefix, streamId);

   }

   public String getFlv() {
      return this.flv;
   }

   public String getM3u8() {
      return this.m3u8;
   }

   public String getMp4() {
      return this.mp4;
   }

   public String getWebrtc() {
      return this.webrtc;
   }

   public String getHls() {
      return this.hls;
   }

   public void setFlv(String flv) {
      this.flv = flv;
   }

   public void setM3u8(String m3u8) {
      this.m3u8 = m3u8;
   }

   public void setMp4(String mp4) {
      this.mp4 = mp4;
   }

   public void setWebrtc(String webrtc) {
      this.webrtc = webrtc;
   }

   public void setHls(String hls) {
      this.hls = hls;
   }

   public boolean equals(Object o) {
      if(o == this) {
         return true;
      } else if(!(o instanceof ZlmConvertUrl)) {
         return false;
      } else {
         ZlmConvertUrl other = (ZlmConvertUrl)o;
         if(!other.canEqual(this)) {
            return false;
         } else {
            label71: {
               Object this$flv = this.getFlv();
               Object other$flv = other.getFlv();
               if(this$flv == null) {
                  if(other$flv == null) {
                     break label71;
                  }
               } else if(this$flv.equals(other$flv)) {
                  break label71;
               }

               return false;
            }

            Object this$m3u8 = this.getM3u8();
            Object other$m3u8 = other.getM3u8();
            if(this$m3u8 == null) {
               if(other$m3u8 != null) {
                  return false;
               }
            } else if(!this$m3u8.equals(other$m3u8)) {
               return false;
            }

            label57: {
               Object this$mp4 = this.getMp4();
               Object other$mp4 = other.getMp4();
               if(this$mp4 == null) {
                  if(other$mp4 == null) {
                     break label57;
                  }
               } else if(this$mp4.equals(other$mp4)) {
                  break label57;
               }

               return false;
            }

            Object this$webrtc = this.getWebrtc();
            Object other$webrtc = other.getWebrtc();
            if(this$webrtc == null) {
               if(other$webrtc != null) {
                  return false;
               }
            } else if(!this$webrtc.equals(other$webrtc)) {
               return false;
            }

            Object this$hls = this.getHls();
            Object other$hls = other.getHls();
            if(this$hls == null) {
               if(other$hls == null) {
                  return true;
               }
            } else if(this$hls.equals(other$hls)) {
               return true;
            }

            return false;
         }
      }
   }

   protected boolean canEqual(Object other) {
      return other instanceof ZlmConvertUrl;
   }

   public int hashCode() {
      int PRIME = 1;
      int result = 1;
      Object $flv = this.getFlv();
      result = result * 59 + ($flv == null?43:$flv.hashCode());
      Object $m3u8 = this.getM3u8();
      result = result * 59 + ($m3u8 == null?43:$m3u8.hashCode());
      Object $mp4 = this.getMp4();
      result = result * 59 + ($mp4 == null?43:$mp4.hashCode());
      Object $webrtc = this.getWebrtc();
      result = result * 59 + ($webrtc == null?43:$webrtc.hashCode());
      Object $hls = this.getHls();
      result = result * 59 + ($hls == null?43:$hls.hashCode());
      return result;
   }

   public String toString() {
      return "ZlmConvertUrl(flv=" + this.getFlv() + ", m3u8=" + this.getM3u8() + ", mp4=" + this.getMp4() + ", webrtc=" + this.getWebrtc() + ", hls=" + this.getHls() + ")";
   }
}
