package com.phlx.anchorcollect.db.gen;

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.phlx.anchorcollect.entity.CardEntity;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/** 
 * DAO for table "CARD_ENTITY".
*/
public class CardEntityDao extends AbstractDao<CardEntity, Long> {

    public static final String TABLENAME = "CARD_ENTITY";

    /**
     * Properties of entity CardEntity.<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 Unid = new Property(1, long.class, "unid", true, "_id");
        public final static Property RegistrationNo = new Property(2, String.class, "registrationNo", false, "REGISTRATION_NO");
        public final static Property IndividualNo = new Property(3, String.class, "individualNo", false, "INDIVIDUAL_NO");
        public final static Property Type = new Property(4, String.class, "type", false, "TYPE");
        public final static Property CircleNo = new Property(5, String.class, "circleNo", false, "CIRCLE_NO");
        public final static Property Varieties = new Property(6, String.class, "varieties", false, "VARIETIES");
        public final static Property Subtypes = new Property(7, String.class, "subtypes", false, "SUBTYPES");
        public final static Property Birthdate = new Property(8, String.class, "birthdate", false, "BIRTHDATE");
        public final static Property Sex = new Property(9, String.class, "sex", false, "SEX");
        public final static Property Grade = new Property(10, String.class, "grade", false, "GRADE");
        public final static Property FatherReg = new Property(11, String.class, "fatherReg", false, "FATHER_REG");
        public final static Property MotherReg = new Property(12, String.class, "motherReg", false, "MOTHER_REG");
        public final static Property ChildTime = new Property(13, String.class, "childTime", false, "CHILD_TIME");
        public final static Property IsTwins = new Property(14, String.class, "isTwins", false, "IS_TWINS");
        public final static Property IsOut = new Property(15, String.class, "isOut", false, "IS_OUT");
        public final static Property BirthHeavy = new Property(16, String.class, "birthHeavy", false, "BIRTH_HEAVY");
        public final static Property FromMilkHeavy = new Property(17, String.class, "fromMilkHeavy", false, "FROM_MILK_HEAVY");
        public final static Property JunHeavy = new Property(18, String.class, "junHeavy", false, "JUN_HEAVY");
        public final static Property DecAppScore = new Property(19, String.class, "decAppScore", false, "DEC_APP_SCORE");
        public final static Property EaseBirth = new Property(20, String.class, "easeBirth", false, "EASE_BIRTH");
        public final static Property IsColostrum = new Property(21, String.class, "isColostrum", false, "IS_COLOSTRUM");
        public final static Property IsDehorning = new Property(22, String.class, "isDehorning", false, "IS_DEHORNING");
        public final static Property Status = new Property(23, String.class, "status", false, "STATUS");
        public final static Property Path = new Property(24, String.class, "path", false, "PATH");
        public final static Property ImgStr = new Property(25, String.class, "imgStr", false, "IMG_STR");
        public final static Property UpdateId = new Property(26, String.class, "updateId", false, "UPDATE_ID");
        public final static Property DataId = new Property(27, String.class, "dataId", false, "DATA_ID");
        public final static Property CreateBy = new Property(28, String.class, "createBy", false, "CREATE_BY");
        public final static Property CreateTime = new Property(29, String.class, "createTime", false, "CREATE_TIME");
        public final static Property UpdateBy = new Property(30, String.class, "updateBy", false, "UPDATE_BY");
        public final static Property UpdateTime = new Property(31, String.class, "updateTime", false, "UPDATE_TIME");
        public final static Property Permissions = new Property(32, String.class, "permissions", false, "PERMISSIONS");
        public final static Property InputTime = new Property(33, String.class, "inputTime", false, "INPUT_TIME");
    }


    public CardEntityDao(DaoConfig config) {
        super(config);
    }
    
    public CardEntityDao(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 + "\"CARD_ENTITY\" (" + //
                "\"ID\" INTEGER," + // 0: id
                "\"_id\" INTEGER PRIMARY KEY NOT NULL ," + // 1: unid
                "\"REGISTRATION_NO\" TEXT," + // 2: registrationNo
                "\"INDIVIDUAL_NO\" TEXT," + // 3: individualNo
                "\"TYPE\" TEXT," + // 4: type
                "\"CIRCLE_NO\" TEXT," + // 5: circleNo
                "\"VARIETIES\" TEXT," + // 6: varieties
                "\"SUBTYPES\" TEXT," + // 7: subtypes
                "\"BIRTHDATE\" TEXT," + // 8: birthdate
                "\"SEX\" TEXT," + // 9: sex
                "\"GRADE\" TEXT," + // 10: grade
                "\"FATHER_REG\" TEXT," + // 11: fatherReg
                "\"MOTHER_REG\" TEXT," + // 12: motherReg
                "\"CHILD_TIME\" TEXT," + // 13: childTime
                "\"IS_TWINS\" TEXT," + // 14: isTwins
                "\"IS_OUT\" TEXT," + // 15: isOut
                "\"BIRTH_HEAVY\" TEXT," + // 16: birthHeavy
                "\"FROM_MILK_HEAVY\" TEXT," + // 17: fromMilkHeavy
                "\"JUN_HEAVY\" TEXT," + // 18: junHeavy
                "\"DEC_APP_SCORE\" TEXT," + // 19: decAppScore
                "\"EASE_BIRTH\" TEXT," + // 20: easeBirth
                "\"IS_COLOSTRUM\" TEXT," + // 21: isColostrum
                "\"IS_DEHORNING\" TEXT," + // 22: isDehorning
                "\"STATUS\" TEXT," + // 23: status
                "\"PATH\" TEXT," + // 24: path
                "\"IMG_STR\" TEXT," + // 25: imgStr
                "\"UPDATE_ID\" TEXT," + // 26: updateId
                "\"DATA_ID\" TEXT," + // 27: dataId
                "\"CREATE_BY\" TEXT," + // 28: createBy
                "\"CREATE_TIME\" TEXT," + // 29: createTime
                "\"UPDATE_BY\" TEXT," + // 30: updateBy
                "\"UPDATE_TIME\" TEXT," + // 31: updateTime
                "\"PERMISSIONS\" TEXT," + // 32: permissions
                "\"INPUT_TIME\" TEXT);"); // 33: inputTime
    }

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

    @Override
    protected final void bindValues(DatabaseStatement stmt, CardEntity entity) {
        stmt.clearBindings();
 
        Long id = entity.getId();
        if (id != null) {
            stmt.bindLong(1, id);
        }
        stmt.bindLong(2, entity.getUnid());
 
        String registrationNo = entity.getRegistrationNo();
        if (registrationNo != null) {
            stmt.bindString(3, registrationNo);
        }
 
        String individualNo = entity.getIndividualNo();
        if (individualNo != null) {
            stmt.bindString(4, individualNo);
        }
 
        String type = entity.getType();
        if (type != null) {
            stmt.bindString(5, type);
        }
 
        String circleNo = entity.getCircleNo();
        if (circleNo != null) {
            stmt.bindString(6, circleNo);
        }
 
        String varieties = entity.getVarieties();
        if (varieties != null) {
            stmt.bindString(7, varieties);
        }
 
        String subtypes = entity.getSubtypes();
        if (subtypes != null) {
            stmt.bindString(8, subtypes);
        }
 
        String birthdate = entity.getBirthdate();
        if (birthdate != null) {
            stmt.bindString(9, birthdate);
        }
 
        String sex = entity.getSex();
        if (sex != null) {
            stmt.bindString(10, sex);
        }
 
        String grade = entity.getGrade();
        if (grade != null) {
            stmt.bindString(11, grade);
        }
 
        String fatherReg = entity.getFatherReg();
        if (fatherReg != null) {
            stmt.bindString(12, fatherReg);
        }
 
        String motherReg = entity.getMotherReg();
        if (motherReg != null) {
            stmt.bindString(13, motherReg);
        }
 
        String childTime = entity.getChildTime();
        if (childTime != null) {
            stmt.bindString(14, childTime);
        }
 
        String isTwins = entity.getIsTwins();
        if (isTwins != null) {
            stmt.bindString(15, isTwins);
        }
 
        String isOut = entity.getIsOut();
        if (isOut != null) {
            stmt.bindString(16, isOut);
        }
 
        String birthHeavy = entity.getBirthHeavy();
        if (birthHeavy != null) {
            stmt.bindString(17, birthHeavy);
        }
 
        String fromMilkHeavy = entity.getFromMilkHeavy();
        if (fromMilkHeavy != null) {
            stmt.bindString(18, fromMilkHeavy);
        }
 
        String junHeavy = entity.getJunHeavy();
        if (junHeavy != null) {
            stmt.bindString(19, junHeavy);
        }
 
        String decAppScore = entity.getDecAppScore();
        if (decAppScore != null) {
            stmt.bindString(20, decAppScore);
        }
 
        String easeBirth = entity.getEaseBirth();
        if (easeBirth != null) {
            stmt.bindString(21, easeBirth);
        }
 
        String isColostrum = entity.getIsColostrum();
        if (isColostrum != null) {
            stmt.bindString(22, isColostrum);
        }
 
        String isDehorning = entity.getIsDehorning();
        if (isDehorning != null) {
            stmt.bindString(23, isDehorning);
        }
 
        String status = entity.getStatus();
        if (status != null) {
            stmt.bindString(24, status);
        }
 
        String path = entity.getPath();
        if (path != null) {
            stmt.bindString(25, path);
        }
 
        String imgStr = entity.getImgStr();
        if (imgStr != null) {
            stmt.bindString(26, imgStr);
        }
 
        String updateId = entity.getUpdateId();
        if (updateId != null) {
            stmt.bindString(27, updateId);
        }
 
        String dataId = entity.getDataId();
        if (dataId != null) {
            stmt.bindString(28, dataId);
        }
 
        String createBy = entity.getCreateBy();
        if (createBy != null) {
            stmt.bindString(29, createBy);
        }
 
        String createTime = entity.getCreateTime();
        if (createTime != null) {
            stmt.bindString(30, createTime);
        }
 
        String updateBy = entity.getUpdateBy();
        if (updateBy != null) {
            stmt.bindString(31, updateBy);
        }
 
        String updateTime = entity.getUpdateTime();
        if (updateTime != null) {
            stmt.bindString(32, updateTime);
        }
 
        String permissions = entity.getPermissions();
        if (permissions != null) {
            stmt.bindString(33, permissions);
        }
 
        String inputTime = entity.getInputTime();
        if (inputTime != null) {
            stmt.bindString(34, inputTime);
        }
    }

    @Override
    protected final void bindValues(SQLiteStatement stmt, CardEntity entity) {
        stmt.clearBindings();
 
        Long id = entity.getId();
        if (id != null) {
            stmt.bindLong(1, id);
        }
        stmt.bindLong(2, entity.getUnid());
 
        String registrationNo = entity.getRegistrationNo();
        if (registrationNo != null) {
            stmt.bindString(3, registrationNo);
        }
 
        String individualNo = entity.getIndividualNo();
        if (individualNo != null) {
            stmt.bindString(4, individualNo);
        }
 
        String type = entity.getType();
        if (type != null) {
            stmt.bindString(5, type);
        }
 
        String circleNo = entity.getCircleNo();
        if (circleNo != null) {
            stmt.bindString(6, circleNo);
        }
 
        String varieties = entity.getVarieties();
        if (varieties != null) {
            stmt.bindString(7, varieties);
        }
 
        String subtypes = entity.getSubtypes();
        if (subtypes != null) {
            stmt.bindString(8, subtypes);
        }
 
        String birthdate = entity.getBirthdate();
        if (birthdate != null) {
            stmt.bindString(9, birthdate);
        }
 
        String sex = entity.getSex();
        if (sex != null) {
            stmt.bindString(10, sex);
        }
 
        String grade = entity.getGrade();
        if (grade != null) {
            stmt.bindString(11, grade);
        }
 
        String fatherReg = entity.getFatherReg();
        if (fatherReg != null) {
            stmt.bindString(12, fatherReg);
        }
 
        String motherReg = entity.getMotherReg();
        if (motherReg != null) {
            stmt.bindString(13, motherReg);
        }
 
        String childTime = entity.getChildTime();
        if (childTime != null) {
            stmt.bindString(14, childTime);
        }
 
        String isTwins = entity.getIsTwins();
        if (isTwins != null) {
            stmt.bindString(15, isTwins);
        }
 
        String isOut = entity.getIsOut();
        if (isOut != null) {
            stmt.bindString(16, isOut);
        }
 
        String birthHeavy = entity.getBirthHeavy();
        if (birthHeavy != null) {
            stmt.bindString(17, birthHeavy);
        }
 
        String fromMilkHeavy = entity.getFromMilkHeavy();
        if (fromMilkHeavy != null) {
            stmt.bindString(18, fromMilkHeavy);
        }
 
        String junHeavy = entity.getJunHeavy();
        if (junHeavy != null) {
            stmt.bindString(19, junHeavy);
        }
 
        String decAppScore = entity.getDecAppScore();
        if (decAppScore != null) {
            stmt.bindString(20, decAppScore);
        }
 
        String easeBirth = entity.getEaseBirth();
        if (easeBirth != null) {
            stmt.bindString(21, easeBirth);
        }
 
        String isColostrum = entity.getIsColostrum();
        if (isColostrum != null) {
            stmt.bindString(22, isColostrum);
        }
 
        String isDehorning = entity.getIsDehorning();
        if (isDehorning != null) {
            stmt.bindString(23, isDehorning);
        }
 
        String status = entity.getStatus();
        if (status != null) {
            stmt.bindString(24, status);
        }
 
        String path = entity.getPath();
        if (path != null) {
            stmt.bindString(25, path);
        }
 
        String imgStr = entity.getImgStr();
        if (imgStr != null) {
            stmt.bindString(26, imgStr);
        }
 
        String updateId = entity.getUpdateId();
        if (updateId != null) {
            stmt.bindString(27, updateId);
        }
 
        String dataId = entity.getDataId();
        if (dataId != null) {
            stmt.bindString(28, dataId);
        }
 
        String createBy = entity.getCreateBy();
        if (createBy != null) {
            stmt.bindString(29, createBy);
        }
 
        String createTime = entity.getCreateTime();
        if (createTime != null) {
            stmt.bindString(30, createTime);
        }
 
        String updateBy = entity.getUpdateBy();
        if (updateBy != null) {
            stmt.bindString(31, updateBy);
        }
 
        String updateTime = entity.getUpdateTime();
        if (updateTime != null) {
            stmt.bindString(32, updateTime);
        }
 
        String permissions = entity.getPermissions();
        if (permissions != null) {
            stmt.bindString(33, permissions);
        }
 
        String inputTime = entity.getInputTime();
        if (inputTime != null) {
            stmt.bindString(34, inputTime);
        }
    }

    @Override
    public Long readKey(Cursor cursor, int offset) {
        return cursor.getLong(offset + 1);
    }    

    @Override
    public CardEntity readEntity(Cursor cursor, int offset) {
        CardEntity entity = new CardEntity( //
            cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id
            cursor.getLong(offset + 1), // unid
            cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // registrationNo
            cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // individualNo
            cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // type
            cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // circleNo
            cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // varieties
            cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // subtypes
            cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // birthdate
            cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // sex
            cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // grade
            cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // fatherReg
            cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // motherReg
            cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // childTime
            cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // isTwins
            cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // isOut
            cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // birthHeavy
            cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // fromMilkHeavy
            cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // junHeavy
            cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19), // decAppScore
            cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20), // easeBirth
            cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21), // isColostrum
            cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22), // isDehorning
            cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23), // status
            cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24), // path
            cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25), // imgStr
            cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26), // updateId
            cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27), // dataId
            cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28), // createBy
            cursor.isNull(offset + 29) ? null : cursor.getString(offset + 29), // createTime
            cursor.isNull(offset + 30) ? null : cursor.getString(offset + 30), // updateBy
            cursor.isNull(offset + 31) ? null : cursor.getString(offset + 31), // updateTime
            cursor.isNull(offset + 32) ? null : cursor.getString(offset + 32), // permissions
            cursor.isNull(offset + 33) ? null : cursor.getString(offset + 33) // inputTime
        );
        return entity;
    }
     
    @Override
    public void readEntity(Cursor cursor, CardEntity entity, int offset) {
        entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
        entity.setUnid(cursor.getLong(offset + 1));
        entity.setRegistrationNo(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
        entity.setIndividualNo(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
        entity.setType(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4));
        entity.setCircleNo(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5));
        entity.setVarieties(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6));
        entity.setSubtypes(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7));
        entity.setBirthdate(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8));
        entity.setSex(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9));
        entity.setGrade(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10));
        entity.setFatherReg(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11));
        entity.setMotherReg(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12));
        entity.setChildTime(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13));
        entity.setIsTwins(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14));
        entity.setIsOut(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15));
        entity.setBirthHeavy(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16));
        entity.setFromMilkHeavy(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17));
        entity.setJunHeavy(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18));
        entity.setDecAppScore(cursor.isNull(offset + 19) ? null : cursor.getString(offset + 19));
        entity.setEaseBirth(cursor.isNull(offset + 20) ? null : cursor.getString(offset + 20));
        entity.setIsColostrum(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21));
        entity.setIsDehorning(cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22));
        entity.setStatus(cursor.isNull(offset + 23) ? null : cursor.getString(offset + 23));
        entity.setPath(cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24));
        entity.setImgStr(cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25));
        entity.setUpdateId(cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26));
        entity.setDataId(cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27));
        entity.setCreateBy(cursor.isNull(offset + 28) ? null : cursor.getString(offset + 28));
        entity.setCreateTime(cursor.isNull(offset + 29) ? null : cursor.getString(offset + 29));
        entity.setUpdateBy(cursor.isNull(offset + 30) ? null : cursor.getString(offset + 30));
        entity.setUpdateTime(cursor.isNull(offset + 31) ? null : cursor.getString(offset + 31));
        entity.setPermissions(cursor.isNull(offset + 32) ? null : cursor.getString(offset + 32));
        entity.setInputTime(cursor.isNull(offset + 33) ? null : cursor.getString(offset + 33));
     }
    
    @Override
    protected final Long updateKeyAfterInsert(CardEntity entity, long rowId) {
        entity.setUnid(rowId);
        return rowId;
    }
    
    @Override
    public Long getKey(CardEntity entity) {
        if(entity != null) {
            return entity.getUnid();
        } else {
            return null;
        }
    }

    @Override
    public boolean hasKey(CardEntity entity) {
        throw new UnsupportedOperationException("Unsupported for entities with a non-null key");
    }

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