
export class SelectFileOptions {
  /**
   * 默认值：false
   */
  isCamera: boolean = true;
  /**
   * 默认值：false
   */
  isDCIM: boolean= true;
  /**
   * 默认值：false
   */
  isFileSelection: boolean= true;
  /**
   * 是否由H5自己实现：false
   */
  selfRealization: boolean = false;

  /**
   * 构造函数
   * @param selfRealization       是否由H5自己实现
   * @param isCamera              是否显示相机选项
   * @param isDCIM                是否显示相册选项
   * @param isFileSelection       是否显示文件选项
   */
  constructor(selfRealization: boolean,isCamera: boolean, isDCIM: boolean, isFileSelection: boolean) {
    this.isCamera = isCamera;
    this.isDCIM = isDCIM;
    this.isFileSelection = isFileSelection;
    this.selfRealization = selfRealization;
  }
  /**
   *
   * @param selfRealization       是否由H5自己实现
   * @param isCamera              是否显示相机选项
   * @param isDCIM                是否显示相册选项
   * @param isFileSelection       是否显示文件选项
   */
  setConfig(selfRealization: boolean,isCamera: boolean, isDCIM: boolean, isFileSelection: boolean) {
    this.isCamera = isCamera;
    this.isDCIM = isDCIM;
    this.isFileSelection = isFileSelection;
    this.selfRealization = selfRealization;
  }

  /**
   * 是否只配置了一个选项
   * @return  true 只配置了一个选项
   *          false 配置了多个选项
   */
  onlyOneItemIsSelected():boolean{
    let count = 0;
    if (this.isCamera){
      count++;
    }
    if (this.isDCIM){
      count++;
    }
    if (this.isFileSelection){
      count++;
    }
    return count==1;
  }

}