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

import `in`.techware.carrefour.model.InternalSalesCorrectionBean
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 = "internalSalesCorrection")
class InternalSalesCorrectionEntity() {

    constructor(internalSalesCorrectionBean: InternalSalesCorrectionBean) : this() {

        this.id = internalSalesCorrectionBean.id
        this.departmentSelectedPosition = internalSalesCorrectionBean.departmentSelectedPosition
        this.departmentCode = internalSalesCorrectionBean.departmentCode
        this.department = internalSalesCorrectionBean.department
        this.sectionSelectedPosition = internalSalesCorrectionBean.sectionSelectedPosition
        this.sectionCode = internalSalesCorrectionBean.sectionCode
        this.section = internalSalesCorrectionBean.section
        this.barcode = internalSalesCorrectionBean.barcode
        this.isQuantityEnabled = internalSalesCorrectionBean.isQuantityEnabled
        this.quantity = internalSalesCorrectionBean.quantity
        this.sendStatus = internalSalesCorrectionBean.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(): InternalSalesCorrectionBean {
        var internalSalesCorrectionBean: InternalSalesCorrectionBean = InternalSalesCorrectionBean()

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

        return internalSalesCorrectionBean;
    }
}