import { environment } from "src/environments/environment"

export interface ExcelContentModel {  excelId: string
    thName: string
    engName: string
    thDesc: string
    engDesc: string
    thumbnail: string
    link1: string
    dbSupport: string
    excelObj: any
    uploadBy: string
    dwTime: number
    remark: string
    referId: string
    approveBy: string
}

export class ExcelContentModel implements ExcelContentModel {
    excelId: string
    thName: string
    engName: string
    thDesc: string
    engDesc: string
    thumbnail: string
    link1: string
    dbSupport: string
    excelObj: any
    uploadBy: string
    dwTime: number
    remark: string
    referId: string
    approveBy: string
    constructor(data: Partial<any>) {
        this.excelId = data.excelId?data.excelId:''
        this.thumbnail = data.thumbnail?data.thumbnail:''
        this.link1 = data.link1?data.link1:''
        this.dbSupport = data.dbSupport?data.dbSupport:''
        this.excelObj = data.excelObj?data.excelObj:''
        this.uploadBy = data.uploadBy?data.uploadBy:''
        this.remark = data.remark?data.remark:''
        this.dwTime = data.dwTime?data.dwTime:0
        this.approveBy = data.approveBy?data.approveBy:''
        this.thName = data.thName?data.thName:''
        this.engName = data.engName?data.engName:''
        this.thDesc = data.thDesc?data.thDesc:''
        this.engDesc = data.engDesc?data.engDesc:''
        this.referId = data.referId?data.referId:''
    }
    getImage(){
        if(this.thumbnail){
            return environment.url+"files/image/"+this.thumbnail
        }else{
            return 'assets/images/big/auth-bg.jpg'
        }
    }
}