package `in`.techware.carrefour.dbUtils.entity

import `in`.techware.carrefour.model.WasteBean
import android.arch.persistence.room.ColumnInfo
import android.arch.persistence.room.Entity
import android.arch.persistence.room.PrimaryKey

/**
 * Created by Jemsheer K D on 25 July, 2018.
 * Package `in`.techware.carrefour.dbUtils.entity
 * Project Carrefour
 */


@Entity(tableName = "waste")
class WasteEntity() {

    constructor(wasteBean: WasteBean) : this() {

        this.id = wasteBean.id
        this.originTypeSelectedPosition = wasteBean.originTypeSelectedPosition
        this.originTypeCode = wasteBean.originTypeCode
        this.originType = wasteBean.originType
        this.barcode = wasteBean.barcode
        this.isQuantityEnabled = wasteBean.isQuantityEnabled
        this.quantity = wasteBean.quantity
        this.sendStatus = wasteBean.sendStatus
    }

    @ColumnInfo(name = "id")
    @PrimaryKey(autoGenerate = true)
    var id: Long = 0
    var originTypeSelectedPosition: Int = 0
    var originTypeCode: String = ""
    var originType: String = ""
    var barcode: String = ""
    var isQuantityEnabled: Boolean = false
    var quantity: Float = 1f
    var sendStatus: Int = 0


    fun getBean(): WasteBean {
        var wasteBean: WasteBean = WasteBean()

        wasteBean.id = this.id
        wasteBean.originTypeSelectedPosition = this.originTypeSelectedPosition
        wasteBean.originTypeCode = this.originTypeCode
        wasteBean.originType = this.originType
        wasteBean.barcode = this.barcode
        wasteBean.isQuantityEnabled = this.isQuantityEnabled
        wasteBean.quantity = this.quantity
        wasteBean.sendStatus = this.sendStatus

        return wasteBean;
    }
}