import { Component, Inject, OnInit } from '@angular/core';
import { MAT_DIALOG_DATA } from '@angular/material';
import { BaseComponent } from '../../../share/base.component';
import { MatSnackBar, MatSnackBarConfig } from '@angular/material';
import { Router } from '@angular/router';
import { MatDialog, MatDialogRef } from '@angular/material';

import { FileSelectDirective, FileUploader, FileItem } from 'ng2-file-upload';
import { Http, Headers, RequestOptions, Response, ResponseContentType } from '@angular/http';

const hostUrl = "http://testing01.eclettica.net:9000"
const HOSTURL = "http://testing01.eclettica.net:9000"

@Component({
  selector: 'ca-uploads',
  templateUrl: '../_views/uploads.component.html',
  styleUrls: ['../_views/uploads.component.scss', '../../../share/eclettica.scss']
})
export class UploadsComponent extends BaseComponent implements OnInit {

  uploads = [
    { value: 'file', viewValue: 'File' },
    { value: 'pdf', viewValue: 'Pdf' },
    { value: 'foto', viewValue: 'Foto' },
    { value: 'video', viewValue: 'Video' },
    { value: 'tutti', viewValue: 'Tutti' }
  ];

  input: any;
  buttonSubmitState: boolean;

  constructor(public MatSnackBar: MatSnackBar,
    protected router: Router,
    public dialogRef: MatDialogRef<UploadsComponent>,
    @Inject(MAT_DIALOG_DATA) public data: any) {
    super(router, MatSnackBar);
    this.input = this.data;
  }

  ngOnInit() {
  }

  save() {
    const obj: any = {};
    obj.status = 'OK';
    obj.data = this.input;
    this.dialogRef.close(obj);
  }

  changeTransition() {
    this.input.transition = !this.input.transition;
  }

}
