package com.example.foodordering.weather.dao.greendao;

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

import de.greenrobot.dao.AbstractDao;
import de.greenrobot.dao.Property;
import de.greenrobot.dao.internal.DaoConfig;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.

/**
 * DAO for table "USE_AREA".
*/
public class UseAreaDao extends AbstractDao<UseArea, Void> {

    public static final String TABLENAME = "USE_AREA";

    /**
     * Properties of entity UseArea.<br/>
     * Can be used for QueryBuilder and for referencing column names.
    */
    public static class Properties {
        public final static Property Areaid = new Property(0, String.class, "areaid", false, "AREAID");
        public final static Property Areaid2345 = new Property(1, String.class, "areaid2345", false, "AREAID2345");
        public final static Property AreaName = new Property(2, String.class, "areaName", false, "AREA_NAME");
        public final static Property Main = new Property(3, Boolean.class, "main", false, "MAIN");
    };


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

    /** Creates the underlying database table. */
    public static void createTable(SQLiteDatabase db, boolean ifNotExists) {
        String constraint = ifNotExists? "IF NOT EXISTS ": "";
        db.execSQL("CREATE TABLE " + constraint + "\"USE_AREA\" (" + //
                "\"AREAID\" TEXT," + // 0: areaid
                "\"AREAID2345\" TEXT," + // 1: areaid2345
                "\"AREA_NAME\" TEXT," + // 2: areaName
                "\"MAIN\" INTEGER);"); // 3: main
    }

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

    /** @inheritdoc */
    @Override
    protected void bindValues(SQLiteStatement stmt, UseArea entity) {
        stmt.clearBindings();
 
        String areaid = entity.getAreaid();
        if (areaid != null) {
            stmt.bindString(1, areaid);
        }
 
        String areaid2345 = entity.getAreaid2345();
        if (areaid2345 != null) {
            stmt.bindString(2, areaid2345);
        }
 
        String areaName = entity.getAreaName();
        if (areaName != null) {
            stmt.bindString(3, areaName);
        }
 
        Boolean main = entity.getMain();
        if (main != null) {
            stmt.bindLong(4, main ? 1L: 0L);
        }
    }

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

    /** @inheritdoc */
    @Override
    public UseArea readEntity(Cursor cursor, int offset) {
        UseArea entity = new UseArea( //
            cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0), // areaid
            cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // areaid2345
            cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // areaName
            cursor.isNull(offset + 3) ? null : cursor.getShort(offset + 3) != 0 // main
        );
        return entity;
    }
     
    /** @inheritdoc */
    @Override
    public void readEntity(Cursor cursor, UseArea entity, int offset) {
        entity.setAreaid(cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0));
        entity.setAreaid2345(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
        entity.setAreaName(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
        entity.setMain(cursor.isNull(offset + 3) ? null : cursor.getShort(offset + 3) != 0);
     }
    
    /** @inheritdoc */
    @Override
    protected Void updateKeyAfterInsert(UseArea entity, long rowId) {
        // Unsupported or missing PK type
        return null;
    }
    
    /** @inheritdoc */
    @Override
    public Void getKey(UseArea entity) {
        return null;
    }

    /** @inheritdoc */
    @Override
    protected boolean isEntityUpdateable() {
        return true;
    }
    
}