const Uppy = require('../src/core/Core.js')
const Dashboard = require('../src/plugins/Dashboard')
const GoogleDrive = require('../src/plugins/GoogleDrive')
const Dropbox = require('../src/plugins/Dropbox')
const Webcam = require('../src/plugins/Webcam')
const Tus10 = require('../src/plugins/Tus10')
// const Multipart = require('../src/plugins/Multipart')
const MetaData = require('../src/plugins/MetaData')
const Informer = require('../src/plugins/Informer')
const StatusBar = require('../src/plugins/StatusBar')
// const DragDrop = require('../src/plugins/DragDrop')

const PROTOCOL = location.protocol === 'https:' ? 'https' : 'http'
const TUS_ENDPOINT = PROTOCOL + '://master.tus.io/files/'

// import ru_RU from '../src/locales/ru_RU.js'
// import MagicLog from '../src/plugins/MagicLog'
// import PersistentState from '../src/plugins/PersistentState'

const uppy = Uppy({debug: true, autoProceed: false})
  .use(Dashboard, {
    trigger: '#uppyModalOpener',
    // maxWidth: 350,
    // maxHeight: 400,
    // inline: false,
    target: 'body',
    locale: {
      strings: {browse: 'wow'}
    }
  })
  .use(GoogleDrive, {target: Dashboard, host: 'http://localhost:3020'})
  .use(Dropbox, {target: Dashboard, host: 'http://localhost:3020'})
  // .use(FileInput, {target: '.Uppy', locale: {
  //   strings: {selectToUpload: 'хуй'}
  // }})
  // .use(DragDrop, {target: 'body', locale: {
  //   strings: {chooseFile: 'hmm'}
  // }})
  // .use(ProgressBar, {target: 'body'})
  // .use(dummy)
  .use(Webcam, {target: Dashboard})
  // .use(Multipart, {endpoint: '//api2.transloadit.com'})
  .use(Tus10, {endpoint: TUS_ENDPOINT, resume: true})
  .use(Informer, {target: Dashboard})
  .use(StatusBar, {
    target: Dashboard
  })
  .use(MetaData, {
    fields: [
      { id: 'resizeTo', name: 'Resize to', value: 1200, placeholder: 'specify future image size' },
      { id: 'description', name: 'Description', value: 'none', placeholder: 'describe what the file is for' }
    ]
  })
uppy.run()

uppy.on('core:success', (fileCount) => {
  console.log('бля!')
  console.log(fileCount)
})

// uppy.emit('informer', 'Smile!', 'info', 2000)

var modalTrigger = document.querySelector('#uppyModalOpener')
if (modalTrigger) modalTrigger.click()

@@ -1328,11 +1328,34 @@
 d: '
-%D1%85%D1%83%D0%B9
+%D0%92%D1%8B%D0%B1%D0%B5%D1%80%D0%B8%D1%82%D0%B5 %D1%84%D0%B0%D0%B9%D0%BB %D0%B4%D0%BB%D1%8F %D0%B7%D0%B0%D0%B3%D1%80%D1%83%D0%B7%D0%BA%D0%B8
 '%7D%0A 
@@ -1443,11 +1443,21 @@
 e: '
-hmm
+%D0%92%D1%8B%D0%B1%D0%B5%D1%80%D0%B8%D1%82%D0%B5 %D1%84%D0%B0%D0%B9%D0%BB
 '%7D%0A 
@@ -1728,21 +1728,16 @@
 usBar, %7B
-%0A    
 target: 
@@ -1745,19 +1745,16 @@
 ashboard
-%0A  
 %7D)%0A  .us
@@ -2074,12 +2074,30 @@
 og('
-%D0%B1%D0%BB%D1%8F!
+UPLOAD SUCCESSFUL, YES
 ')%0A 

stop cursing in Russian so much