angular
  .module('angularJSApp.constant', [])
  // All app config in here
  .constant('AppConfig', {
    TOKEN_COOKIE_NAME: 'token',
    USER_FOLDER_ID: 'user-folder-id',
    // Cache module using ocLazyLoad
    OCLAZY_CACHE_MODULE: true, // Should use "true" when deploy to server
    VIEWER_URL: 'https://689cloud.com/viewer/',
    MAX_EXPIRY_DATE: '9999-12-30 23:59:59',
    FORMAT_DATE_SINGAPORE: 'dd/MM/yyyy',
    FORMAT_DATE: 'MM/dd/yyyy',
    UTIL_FORMAT_DATE: 'YYYY/MM/DD HH:mm:ss',
    MAX_EXPIRY_DATE_FORMAT: 'MM/DD/YYYY',
    MAX_EXPIRY_DATE_TIME: '12/31/9999 23:59:59',
    BOOKEND_DATE_FORMAT: 'YYYY-MM-DD HH:mm:ss',
    COMPARE_DATE_FORMAT: 'DD/MM/YYYY',
    TEAM_STATUS: 7,
    EXPIRY_DAYS_NOTIFICATION: 10,
    TURN_ON_ADD_CARD: false,
    FREE_PACKAGE: 'FREE',
  })

  // session type
  .constant('SessionType', {
    PRIMARY_SESSION: 0,
    OTP_SESSION: 1,
    PASSWORD_POLICY_SESSION: 2,
  })

  // team status
  .constant('TeamStatus', {
    Active: 1,
    Deactivate: 2,
    Suspecting: 7,
    Trial: 6,
  })
  // package name
  .constant('PACKAGE_NAME', {
    FREE: 'FREE',
    PERSONAl: 'PERSONAl',
    TEAM: 'TEAM',
    BUSINESS: 'BUSINESS',
  })

  // billing cycle
  .constant('BILLING_CYCLE', {
    MONTHLY: 'MONTHLY',
    ANNUALLY: 'ANNUALLY',
  })

  // currency
  .constant('CURRENCY', {
    USD: 'USD',
    YEN: 'YEN',
  })

  // console type
  .constant('CONSOLE_TYPE', {
    SECURE_MAIL: 'SECURE_MAIL',
    SECURE_DRIVE: 'SECURE_DRIVE',
  })

  // local storage key
  .constant('localStorageKey', {
    PASSWORD_POLICY: 'passwordPolicy',
  })

  // patterns
  .constant('Patterns', {
    EMAIL_PATTERN:
      /^(([^<>()?\[\]\.,;:\s@\"]+(\.[^<>()?\[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()?[\]\.,;:\s@\"]+\.)+[^<>()?[\]\.,;:\s@\"]{2,})$/,
    PASSWORD_PATTERN: /(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d]{6,}$/,
    URL_PATTERN:
      /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/,
    SCRIPT_PATTERN: /^((?!<|>|{|})[\s\S])*?$/,
    PHONE_PATTERN: /^[\(\)\.\- 0-9]*$/,
    NUMBER_PATTERN: /^[0-9]*$/,
  })

  .constant('ViewerSupportType', {
    SUPPORT_TYPES_DOC: ['doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx', 'xlsm', 'pdf'],
    SUPPORT_TYPES_IMG: ['jpg', 'png', 'gif'],
    SUPPORT_AUDIO: ['mp3'],
    SUPPORT_VIDEO: ['mp4'],
  })
  .constant('ViewerUrl', {
    ONE_DRIVE: 'https://view.officeapps.live.com/op/embed.aspx?src=',
    PDF_JS: 'pdfjs/web/viewer.html?file=',
  })

  // All mime type
  .constant('MimeTypes', {
    secure: {
      types: [
        'application/pdf',
        'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
        'application/vnd.openxmlformats-officedocument.presentationml.presentation',
        'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
      ],
      icon: 'I need a default icon right here',
    },
    video: {
      types: [
        'video/mpeg',
        'video/mpeg',
        'video/mpeg',
        'video/quicktime',
        'video/quicktime',
        'video/mp4',
        'video/x-m4v',
        'video/x-flv',
        'video/x-ms-wmv',
        'video/avi',
        'video/webm',
        'video/vnd.rn-realvideo',
      ],
      icon: 'img/ui/file-video-32.png',
    },
    audio: {
      types: ['audio/mpeg', 'audio/mpeg', 'audio/mpeg', 'audio/mpeg', 'audio/x-wav', 'audio/mp4'],
      icon: 'img/ui/file-audio-32.png',
    },
    image: {
      types: [
        'image/bmp',
        'image/gif',
        'image/jpeg',
        'image/photoshop',
        'image/png',
        'image/svg+xml',
        'image/svg+xml',
        'image/tiff',
        'image/tiff',
      ],
      icon: 'img/ui/file-image-32.png',
    },
    compress: {
      types: [
        'application/zip',
        'application/rar',
        'application/x-zip-compressed',
        'application/x-gunzip',
        'application/x-gzip',
        'application/x-7z-compressed',
      ],
      icon: 'img/ui/file-compress-32.png',
    },
    text: {
      types: ['text/rtf', 'text/plain', 'text/html', 'text/xml', 'text/css', 'text/csv'],
      icon: 'img/ui/file-text-32.png',
    },
    folder: {
      types: ['application/folder'],
      icon: 'img/ui/folder-icon.png',
    },
    project: {
      types: ['application/project'],
      icon: 'img/ui/folder-icon.png',
    },
    office: {
      types: ['application/msword', 'application/vnd.ms-excel', 'application/vnd.ms-powerpoint'],
    },
    default: {
      icon: 'img/ui/file-default.png',
    },
  })

  // Detail of secure file
  .constant('MimeTypeDetail', {
    PDF: { type: 'application/pdf', ext: 'pdf', icon: 'img/ui/file-pdf-32.png' },
    WORD: {
      type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
      ext: 'docx',
      icon: 'img/ui/file-docx-32.png',
    },
    PPTX: {
      type: 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
      ext: 'pptx',
      icon: 'img/ui/file-pptx-32.png',
    },
    EXCEL: {
      type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
      ext: 'xlsx',
      icon: 'img/ui/file-xlsx-32.png',
    },
  })

  .constant('exchangeRate', {
    USD: 1,
    VND: 20000,
    JPY: 100,
  })

  .constant('currencyUnit', {
    USD: '$',
    YEN: '￥',
    VND: '₫',
  })

  .constant('cardType', {
    UNKNOWN: { id: 0, value: 'Unknown' },
    VISA: { id: 1, value: 'Visa' },
    MASTERCARD: { id: 2, value: 'MasterCard' },
    AMERICAN_EXPRESS: { id: 3, value: 'American Express' },
    DINERS_CLUB: { id: 4, value: 'Diners Club' },
    DISCOVER: { id: 5, value: 'Discover' },
    JCB: { id: 6, value: 'JCB' },
    UNIONPAY: { id: 7, value: 'UnionPay' },
  })
  // Config user role info
  // User level in our system
  .constant('userConfig', {
    TEAM_ADMIN: {
      role: 1,
      login_link: 'login',
      landing_page: 'dashboard',
      landing_page_state: 'login',
    },
    MANAGER: {
      role: 2,
      login_link: 'login',
      landing_page: 'dashboard',
      landing_page_state: 'login',
    },
    MEMBER: {
      role: 3,
      login_link: 'login',
      landing_page: 'dashboard',
      landing_page_state: 'login',
    },
    GUEST: {
      role: 4,
      login_link: 'login',
      landing_page: 'dashboard',
      landing_page_state: 'login',
    },
  })
  .constant('paymentType', {
    ONLINE: 0,
    OFFLINE: 1,
  })
  .constant('serviceKeyType', {
    // 1: Secure Drive, 2:Secure Mail
    SECURE_DRIVE: 1,
    SECURE_MAIL: 2,
  })
  .constant('packageUpgrade', {
    FREE: 'FREE',
    PRO: 'PRO',
    STANDARD: 'STANDARD',
    UP_TO_FREE: '500MB',
    UP_TO_PRO: '1GB',
    TRANSMISSION_FREE: 100,
    TRANSMISSION_PRO: 200,
  })
  .constant('countryCode', {
    JPN: 'JP',
  })
  .constant('currencyInfo', {
    USD: 'USD',
    YEN: 'YEN',
    JPY: 'JPY',
  });
