
import { Component, OnChanges, Input } from '@angular/core';
import { InnovationStatus, InnovationType } from 'app/models/InnovationIdea.model';
import { DomSanitizer, SafeUrl } from '@angular/platform-browser';
import { EmployeeHttpService } from 'app/services/employee/employee-http.service';
import { File } from 'app/models/InnovationIdea.model';

@Component({
  selector: 'app-card-innovation',
  templateUrl: './card-innovation.component.html',
  styleUrls: ['./card-innovation.component.scss']
})
export class CardInnovationComponent implements OnChanges {
  @Input() innovationType: InnovationType;
  @Input() title: string;
  @Input() category: string;
  @Input() description: string;
  @Input() status: InnovationStatus;
  @Input() createdDt: string;
  @Input() reviewerName: string;
  @Input() reviewerFileId: number;

  profileImg: SafeUrl = undefined;

  enumInnovationType = InnovationType;

  constructor(private employeeHttpService: EmployeeHttpService, private sanitizer: DomSanitizer) { }

  ngOnChanges() {
/*     if (this.reviewerFileId) {
      this.employeeHttpService.getEmployeeRelatedFile(this.reviewerFileId)
      .subscribe((s: File[]) => {
        if (s && s.length > 0 && s[0].contentType && s[0].fileContent) {
          console.log('file', s);
          this.profileImg = this.sanitizer.bypassSecurityTrustUrl(`data:${s[0].contentType};base64, ${s[0].fileContent}`);
        }
      });
    } */
  }

}
