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

import `in`.techware.carrefour.model.InternalSalesBean
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 = "internalSales")
class InternalSalesEntity() {

    constructor(internalSalesBean: InternalSalesBean) : this() {

        this.id = internalSalesBean.id
        this.departmentSelectedPosition = internalSalesBean.departmentSelectedPosition
        this.departmentCode = internalSalesBean.departmentCode
        this.department = internalSalesBean.department
        this.sectionSelectedPosition = internalSalesBean.sectionSelectedPosition
        this.sectionCode = internalSalesBean.sectionCode
        this.section = internalSalesBean.section
        this.barcode = internalSalesBean.barcode
        this.isQuantityEnabled = internalSalesBean.isQuantityEnabled
        this.quantity = internalSalesBean.quantity
        this.sendStatus = internalSalesBean.sendStatus
    }

    @ColumnInfo(name = "id")
    @PrimaryKey(autoGenerate = true)
    var id: Long = 0
    var departmentSelectedPosition: Int = 0
    var departmentCode: String = ""
    var department: String = ""
    var sectionSelectedPosition: Int = 0
    var sectionCode: String = ""
    var section: String = ""
    var barcode: String = ""
    var isQuantityEnabled: Boolean = false
    var quantity: Float = 1f
    var sendStatus: Int = 0


    fun getBean(): InternalSalesBean {
        var internalSalesBean: InternalSalesBean = InternalSalesBean()

        internalSalesBean.id = this.id
        internalSalesBean.departmentSelectedPosition = this.departmentSelectedPosition
        internalSalesBean.departmentCode = this.departmentCode
        internalSalesBean.department = this.department
        internalSalesBean.sectionSelectedPosition = this.sectionSelectedPosition
        internalSalesBean.sectionCode = this.sectionCode
        internalSalesBean.section = this.section
        internalSalesBean.barcode = this.barcode
        internalSalesBean.isQuantityEnabled = this.isQuantityEnabled
        internalSalesBean.quantity = this.quantity
        internalSalesBean.sendStatus = this.sendStatus

        return internalSalesBean;
    }
}