package com.gingersoft.gsa.cloud.database.greendao;

import android.database.Cursor;
import android.database.sqlite.SQLiteStatement;

import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.Property;
import org.greenrobot.greendao.internal.DaoConfig;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.database.DatabaseStatement;

import com.gingersoft.gsa.cloud.database.bean.FoodCombo;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/** 
 * DAO for table "FOOD_COMBO".
*/
public class FoodComboDao extends AbstractDao<FoodCombo, Void> {

    public static final String TABLENAME = "FOOD_COMBO";

    /**
     * Properties of entity FoodCombo.<br/>
     * Can be used for QueryBuilder and for referencing column names.
     */
    public static class Properties {
        public final static Property Id = new Property(0, Long.class, "id", false, "_id");
        public final static Property Fid = new Property(1, Long.class, "fid", false, "FID");
        public final static Property ComId = new Property(2, int.class, "comId", false, "COM_ID");
        public final static Property SeqNo = new Property(3, int.class, "seqNo", false, "SEQ_NO");
        public final static Property DiffAmt = new Property(4, int.class, "diffAmt", false, "DIFF_AMT");
        public final static Property SelectQty = new Property(5, int.class, "selectQty", false, "SELECT_QTY");
        public final static Property CreateTime = new Property(6, String.class, "createTime", false, "CREATE_TIME");
        public final static Property DefModifier = new Property(7, String.class, "defModifier", false, "DEF_MODIFIER");
        public final static Property ExcModifier = new Property(8, String.class, "excModifier", false, "EXC_MODIFIER");
        public final static Property AutoNext = new Property(9, int.class, "autoNext", false, "AUTO_NEXT");
        public final static Property MultipleSelect = new Property(10, int.class, "multipleSelect", false, "MULTIPLE_SELECT");
        public final static Property UpdateTime = new Property(11, String.class, "updateTime", false, "UPDATE_TIME");
        public final static Property Conditions = new Property(12, int.class, "conditions", false, "CONDITIONS");
        public final static Property IsRT = new Property(13, int.class, "isRT", false, "IS_RT");
        public final static Property Deletes = new Property(14, int.class, "deletes", false, "DELETES");
        public final static Property RestaurantId = new Property(15, int.class, "restaurantId", false, "RESTAURANT_ID");
    }


    public FoodComboDao(DaoConfig config) {
        super(config);
    }
    
    public FoodComboDao(DaoConfig config, DaoSession daoSession) {
        super(config, daoSession);
    }

    /** Creates the underlying database table. */
    public static void createTable(Database db, boolean ifNotExists) {
        String constraint = ifNotExists? "IF NOT EXISTS ": "";
        db.execSQL("CREATE TABLE " + constraint + "\"FOOD_COMBO\" (" + //
                "\"_id\" INTEGER," + // 0: id
                "\"FID\" INTEGER," + // 1: fid
                "\"COM_ID\" INTEGER NOT NULL ," + // 2: comId
                "\"SEQ_NO\" INTEGER NOT NULL ," + // 3: seqNo
                "\"DIFF_AMT\" INTEGER NOT NULL ," + // 4: diffAmt
                "\"SELECT_QTY\" INTEGER NOT NULL ," + // 5: selectQty
                "\"CREATE_TIME\" TEXT," + // 6: createTime
                "\"DEF_MODIFIER\" TEXT," + // 7: defModifier
                "\"EXC_MODIFIER\" TEXT," + // 8: excModifier
                "\"AUTO_NEXT\" INTEGER NOT NULL ," + // 9: autoNext
                "\"MULTIPLE_SELECT\" INTEGER NOT NULL ," + // 10: multipleSelect
                "\"UPDATE_TIME\" TEXT," + // 11: updateTime
                "\"CONDITIONS\" INTEGER NOT NULL ," + // 12: conditions
                "\"IS_RT\" INTEGER NOT NULL ," + // 13: isRT
                "\"DELETES\" INTEGER NOT NULL ," + // 14: deletes
                "\"RESTAURANT_ID\" INTEGER NOT NULL );"); // 15: restaurantId
    }

    /** Drops the underlying database table. */
    public static void dropTable(Database db, boolean ifExists) {
        String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"FOOD_COMBO\"";
        db.execSQL(sql);
    }

    @Override
    protected final void bindValues(DatabaseStatement stmt, FoodCombo entity) {
        stmt.clearBindings();
 
        Long id = entity.getId();
        if (id != null) {
            stmt.bindLong(1, id);
        }
 
        Long fid = entity.getFid();
        if (fid != null) {
            stmt.bindLong(2, fid);
        }
        stmt.bindLong(3, entity.getComId());
        stmt.bindLong(4, entity.getSeqNo());
        stmt.bindLong(5, entity.getDiffAmt());
        stmt.bindLong(6, entity.getSelectQty());
 
        String createTime = entity.getCreateTime();
        if (createTime != null) {
            stmt.bindString(7, createTime);
        }
 
        String defModifier = entity.getDefModifier();
        if (defModifier != null) {
            stmt.bindString(8, defModifier);
        }
 
        String excModifier = entity.getExcModifier();
        if (excModifier != null) {
            stmt.bindString(9, excModifier);
        }
        stmt.bindLong(10, entity.getAutoNext());
        stmt.bindLong(11, entity.getMultipleSelect());
 
        String updateTime = entity.getUpdateTime();
        if (updateTime != null) {
            stmt.bindString(12, updateTime);
        }
        stmt.bindLong(13, entity.getConditions());
        stmt.bindLong(14, entity.getIsRT());
        stmt.bindLong(15, entity.getDeletes());
        stmt.bindLong(16, entity.getRestaurantId());
    }

    @Override
    protected final void bindValues(SQLiteStatement stmt, FoodCombo entity) {
        stmt.clearBindings();
 
        Long id = entity.getId();
        if (id != null) {
            stmt.bindLong(1, id);
        }
 
        Long fid = entity.getFid();
        if (fid != null) {
            stmt.bindLong(2, fid);
        }
        stmt.bindLong(3, entity.getComId());
        stmt.bindLong(4, entity.getSeqNo());
        stmt.bindLong(5, entity.getDiffAmt());
        stmt.bindLong(6, entity.getSelectQty());
 
        String createTime = entity.getCreateTime();
        if (createTime != null) {
            stmt.bindString(7, createTime);
        }
 
        String defModifier = entity.getDefModifier();
        if (defModifier != null) {
            stmt.bindString(8, defModifier);
        }
 
        String excModifier = entity.getExcModifier();
        if (excModifier != null) {
            stmt.bindString(9, excModifier);
        }
        stmt.bindLong(10, entity.getAutoNext());
        stmt.bindLong(11, entity.getMultipleSelect());
 
        String updateTime = entity.getUpdateTime();
        if (updateTime != null) {
            stmt.bindString(12, updateTime);
        }
        stmt.bindLong(13, entity.getConditions());
        stmt.bindLong(14, entity.getIsRT());
        stmt.bindLong(15, entity.getDeletes());
        stmt.bindLong(16, entity.getRestaurantId());
    }

    @Override
    public Void readKey(Cursor cursor, int offset) {
        return null;
    }    

    @Override
    public FoodCombo readEntity(Cursor cursor, int offset) {
        FoodCombo entity = new FoodCombo( //
            cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id
            cursor.isNull(offset + 1) ? null : cursor.getLong(offset + 1), // fid
            cursor.getInt(offset + 2), // comId
            cursor.getInt(offset + 3), // seqNo
            cursor.getInt(offset + 4), // diffAmt
            cursor.getInt(offset + 5), // selectQty
            cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // createTime
            cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // defModifier
            cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // excModifier
            cursor.getInt(offset + 9), // autoNext
            cursor.getInt(offset + 10), // multipleSelect
            cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // updateTime
            cursor.getInt(offset + 12), // conditions
            cursor.getInt(offset + 13), // isRT
            cursor.getInt(offset + 14), // deletes
            cursor.getInt(offset + 15) // restaurantId
        );
        return entity;
    }
     
    @Override
    public void readEntity(Cursor cursor, FoodCombo entity, int offset) {
        entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
        entity.setFid(cursor.isNull(offset + 1) ? null : cursor.getLong(offset + 1));
        entity.setComId(cursor.getInt(offset + 2));
        entity.setSeqNo(cursor.getInt(offset + 3));
        entity.setDiffAmt(cursor.getInt(offset + 4));
        entity.setSelectQty(cursor.getInt(offset + 5));
        entity.setCreateTime(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6));
        entity.setDefModifier(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7));
        entity.setExcModifier(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8));
        entity.setAutoNext(cursor.getInt(offset + 9));
        entity.setMultipleSelect(cursor.getInt(offset + 10));
        entity.setUpdateTime(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11));
        entity.setConditions(cursor.getInt(offset + 12));
        entity.setIsRT(cursor.getInt(offset + 13));
        entity.setDeletes(cursor.getInt(offset + 14));
        entity.setRestaurantId(cursor.getInt(offset + 15));
     }
    
    @Override
    protected final Void updateKeyAfterInsert(FoodCombo entity, long rowId) {
        // Unsupported or missing PK type
        return null;
    }
    
    @Override
    public Void getKey(FoodCombo entity) {
        return null;
    }

    @Override
    public boolean hasKey(FoodCombo entity) {
        // TODO
        return false;
    }

    @Override
    protected final boolean isEntityUpdateable() {
        return true;
    }
    
}
