package de.ivu.elect.business.internet.entity;

import java.io.Serializable;

import org.apache.commons.lang3.StringUtils;

public class InternetWidgetFile implements Serializable {

  private static final long serialVersionUID = 1L;

  private Long position;

  private String filename;

  private String label;

  private byte[] content;

  public InternetWidgetFile(Long position, String filename, String label, byte[] content) {
    this.position = position;
    this.filename = filename;
    this.label = label;
    this.content = content;
  }

  public String getFilename() {
    return filename;
  }

  public void setFilename(String filename) {
    this.filename = filename;
  }

  public String getLabel() {
    return label;
  }

  public void setLabel(String label) {
    this.label = label;
  }

  public byte[] getContent() {
    return content;
  }

  public void setContent(byte[] content) {
    this.content = content;
  }

  public Long getPosition() {
    return position;
  }

  public void setPosition(Long position) {
    this.position = position;
  }

  public Long getContentSize() {
    if (content == null) {
      return null;
    }
    return Long.valueOf(content.length);
  }

  public boolean isVollstaendig() {
    return StringUtils.isNotBlank(getFilename()) /*&& StringUtils.isNotBlank(getLabel())*/ && content != null;
  }
}
