import { Component, Input, OnInit } from '@angular/core';

@Component({
  selector: 'art-status',
  template: `

<nz-tag nzColor="#28a745" *ngIf="item?.status == artStatus.ONLINE"><i class="fal fa-badge-check"></i><span *ngIf="showText" i18n>已发布</span></nz-tag>
<nz-tag nzColor="#ffc107" *ngIf="item?.status == artStatus.OFFLINE"><i class="fal fa-exclamation"></i><span *ngIf="showText" i18n>已下线</span></nz-tag>
<nz-tag nzColor="#007bff" *ngIf="item?.status == artStatus.TESTED"> <i class="fal fa-check"></i> <span *ngIf="showText" i18n>测试通过</span> </nz-tag>
<nz-tag nzColor="#17a2b8" *ngIf="item?.status == artStatus.TESTING"><i class="fal fa-user"></i><span *ngIf="showText" i18n>测试中</span></nz-tag>
<nz-tag nzColor="#dc3545" *ngIf="item?.status == artStatus.REJECTED"><i class="fal fa-pencil"></i><span *ngIf="showText" i18n>需要修改</span></nz-tag>
<nz-tag nzColor="#808080" *ngIf="item?.status == artStatus.REFUSE"><i class="fal fa-times-circle"></i><span *ngIf="showText" i18n>已拒稿</span></nz-tag>
<nz-tag *ngIf="item?.status == artStatus.DRAFT" i18n>草稿</nz-tag>
  `,
  styles: [
    `
  i+span{
    padding-left:5px;
  }
  i.fas{
    font-size:10px;
    display:none;
  }
  `
  ]
})
export class ArtStatusComponent implements OnInit {
  @Input('data') item: any;
  @Input() showText: boolean = true;
  
  artStatus = ArtStatus;

  constructor() { }

  ngOnInit(): void {
  }

}

export enum ArtStatus {
  REFUSE = 500,
  DRAFT = 1000,
  REJECTED = 2000,
  TESTING = 3000,
  TESTED = 7000,
  OFFLINE = 8000,
  ONLINE = 9000,
}