import { Want, wantConstant } from "@kit.AbilityKit";

export class OpenFiles {
  static getWordFileWant(filePath: string) {
    let wantInfo: Want = {
      uri: filePath,
      type: 'application/msword',
      flags: wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION,
    }
    return wantInfo
  }

  static getPdfFileIntent(filePath: string) {
    let wantInfo: Want = {
      uri: filePath,
      type: 'application/pdf',
      flags: wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION,
    }
    return wantInfo
  }

  static getHtmlFileIntent(filePath: string) {
    let wantInfo: Want = {
      uri: filePath,
      type: 'text/html',
      flags: wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION,
    }
    return wantInfo
  }

  static getApkFileIntent(filePath: string) {
    let wantInfo: Want = {
      uri: filePath,
      type: 'application/x-rar-compressed',
      flags: wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION,
    }
    return wantInfo
  }

  static getAudioFileIntent(filePath: string) {
    let wantInfo: Want = {
      uri: filePath,
      type: 'audio/mpeg',
      flags: wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION,
    }
    return wantInfo
  }

  static getVideoFileIntent(filePath: string) {
    let wantInfo: Want = {
      uri: filePath,
      type: 'video/mp4',
      flags: wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION,
    }
    return wantInfo
  }

  static getTextFileIntent(filePath: string) {
    let wantInfo: Want = {
      uri: filePath,
      type: 'text/plain',
      flags: wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION,
    }
    return wantInfo
  }

  static getExcelFileIntent(filePath: string) {
    let wantInfo: Want = {
      uri: filePath,
      type: 'application/vnd.ms-excel',
      flags: wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION,
    }
    return wantInfo
  }

  static getPPTFileIntent(filePath: string) {
    let wantInfo: Want = {
      uri: filePath,
      type: 'application/vnd.ms-powerpoint',
      flags: wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION,
    }
    return wantInfo
  }

  static getImageFileIntent(filePath: string) {
    let wantInfo: Want = {
      uri: filePath,
      type: 'image/jpeg',
      flags: wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION,
    }
    return wantInfo
  }
}