package com.d.music.data.database.greendao.dao;

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

import com.d.music.data.database.greendao.bean.MusicModel;

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 "MUSIC".
 */
public abstract class AbstractMusicDao extends AbstractDao<MusicModel, String> {

    public AbstractMusicDao(DaoConfig config) {
        super(config);
    }

    ;


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

    /**
     * @inheritdoc
     */
    @Override
    protected void bindValues(SQLiteStatement stmt, MusicModel entity) {
        stmt.clearBindings();

        String id = entity.getId();
        if (id != null) {
            stmt.bindString(1, id);
        }

        Integer type = entity.getType();
        if (type != null) {
            stmt.bindLong(2, type);
        }

        Integer seq = entity.getSeq();
        if (seq != null) {
            stmt.bindLong(3, seq);
        }

        String songId = entity.getSongId();
        if (songId != null) {
            stmt.bindString(4, songId);
        }

        String songName = entity.getSongName();
        if (songName != null) {
            stmt.bindString(5, songName);
        }

        String songUrl = entity.getSongUrl();
        if (songUrl != null) {
            stmt.bindString(6, songUrl);
        }

        String artistId = entity.getArtistId();
        if (artistId != null) {
            stmt.bindString(7, artistId);
        }

        String artistName = entity.getArtistName();
        if (artistName != null) {
            stmt.bindString(8, artistName);
        }

        String albumId = entity.getAlbumId();
        if (albumId != null) {
            stmt.bindString(9, albumId);
        }

        String albumName = entity.getAlbumName();
        if (albumName != null) {
            stmt.bindString(10, albumName);
        }

        String albumUrl = entity.getAlbumUrl();
        if (albumUrl != null) {
            stmt.bindString(11, albumUrl);
        }

        String lrcName = entity.getLrcName();
        if (lrcName != null) {
            stmt.bindString(12, lrcName);
        }

        String lrcUrl = entity.getLrcUrl();
        if (lrcUrl != null) {
            stmt.bindString(13, lrcUrl);
        }

        Long fileDuration = entity.getFileDuration();
        if (fileDuration != null) {
            stmt.bindLong(14, fileDuration);
        }

        Long fileSize = entity.getFileSize();
        if (fileSize != null) {
            stmt.bindLong(15, fileSize);
        }

        String filePostfix = entity.getFilePostfix();
        if (filePostfix != null) {
            stmt.bindString(16, filePostfix);
        }

        String fileFolder = entity.getFileFolder();
        if (fileFolder != null) {
            stmt.bindString(17, fileFolder);
        }

        Boolean isCollected = entity.getIsCollected();
        if (isCollected != null) {
            stmt.bindLong(18, isCollected ? 1L : 0L);
        }

        Long timeStamp = entity.getTimeStamp();
        if (timeStamp != null) {
            stmt.bindLong(19, timeStamp);
        }
    }

    /**
     * @inheritdoc
     */
    @Override
    public String readKey(Cursor cursor, int offset) {
        return cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0);
    }

    /**
     * @inheritdoc
     */
    @Override
    public MusicModel readEntity(Cursor cursor, int offset) {
        MusicModel entity = new MusicModel( //
                cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0), // id
                cursor.isNull(offset + 1) ? null : cursor.getInt(offset + 1), // type
                cursor.isNull(offset + 2) ? null : cursor.getInt(offset + 2), // seq
                cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // songId
                cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // songName
                cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // songUrl
                cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // artistId
                cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // artistName
                cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // albumId
                cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // albumName
                cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10), // albumUrl
                cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // lrcName
                cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // lrcUrl
                cursor.isNull(offset + 13) ? null : cursor.getLong(offset + 13), // fileDuration
                cursor.isNull(offset + 14) ? null : cursor.getLong(offset + 14), // fileSize
                cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // filePostfix
                cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // fileFolder
                cursor.isNull(offset + 17) ? null : cursor.getShort(offset + 17) != 0, // isCollected
                cursor.isNull(offset + 18) ? null : cursor.getLong(offset + 18) // timeStamp
        );
        return entity;
    }

    /**
     * @inheritdoc
     */
    @Override
    public void readEntity(Cursor cursor, MusicModel entity, int offset) {
        entity.setId(cursor.isNull(offset + 0) ? null : cursor.getString(offset + 0));
        entity.setType(cursor.isNull(offset + 1) ? null : cursor.getInt(offset + 1));
        entity.setSeq(cursor.isNull(offset + 2) ? null : cursor.getInt(offset + 2));
        entity.setSongId(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
        entity.setSongName(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4));
        entity.setSongUrl(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5));
        entity.setArtistId(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6));
        entity.setArtistName(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7));
        entity.setAlbumId(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8));
        entity.setAlbumName(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9));
        entity.setAlbumUrl(cursor.isNull(offset + 10) ? null : cursor.getString(offset + 10));
        entity.setLrcName(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11));
        entity.setLrcUrl(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12));
        entity.setFileDuration(cursor.isNull(offset + 13) ? null : cursor.getLong(offset + 13));
        entity.setFileSize(cursor.isNull(offset + 14) ? null : cursor.getLong(offset + 14));
        entity.setFilePostfix(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15));
        entity.setFileFolder(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16));
        entity.setIsCollected(cursor.isNull(offset + 17) ? null : cursor.getShort(offset + 17) != 0);
        entity.setTimeStamp(cursor.isNull(offset + 18) ? null : cursor.getLong(offset + 18));
    }

    /**
     * @inheritdoc
     */
    @Override
    protected String updateKeyAfterInsert(MusicModel entity, long rowId) {
        return entity.getId();
    }

    /**
     * @inheritdoc
     */
    @Override
    public String getKey(MusicModel entity) {
        if (entity != null) {
            return entity.getId();
        } else {
            return null;
        }
    }

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

    /**
     * Properties of entity MusicModel.<br/>
     * Can be used for QueryBuilder and for referencing column names.
     */
    public static class CommonProperties {
        public static final Property Id = new Property(0, String.class, "id", true, "ID");
        public static final Property Type = new Property(1, Integer.class, "type", false, "TYPE");
        public static final Property Seq = new Property(2, Integer.class, "seq", false, "SEQ");
        public static final Property SongId = new Property(3, String.class, "songId", false, "SONG_ID");
        public static final Property SongName = new Property(4, String.class, "songName", false, "SONG_NAME");
        public static final Property SongUrl = new Property(5, String.class, "songUrl", false, "SONG_URL");
        public static final Property ArtistId = new Property(6, String.class, "artistId", false, "ARTIST_ID");
        public static final Property ArtistName = new Property(7, String.class, "artistName", false, "ARTIST_NAME");
        public static final Property AlbumId = new Property(8, String.class, "albumId", false, "ALBUM_ID");
        public static final Property AlbumName = new Property(9, String.class, "albumName", false, "ALBUM_NAME");
        public static final Property AlbumUrl = new Property(10, String.class, "albumUrl", false, "ALBUM_URL");
        public static final Property LrcName = new Property(11, String.class, "lrcName", false, "LRC_NAME");
        public static final Property LrcUrl = new Property(12, String.class, "lrcUrl", false, "LRC_URL");
        public static final Property FileDuration = new Property(13, Long.class, "fileDuration", false, "FILE_DURATION");
        public static final Property FileSize = new Property(14, Long.class, "fileSize", false, "FILE_SIZE");
        public static final Property FilePostfix = new Property(15, String.class, "filePostfix", false, "FILE_POSTFIX");
        public static final Property FileFolder = new Property(16, String.class, "fileFolder", false, "FILE_FOLDER");
        public static final Property IsCollected = new Property(17, Boolean.class, "isCollected", false, "IS_COLLECTED");
        public static final Property TimeStamp = new Property(18, Long.class, "timeStamp", false, "TIME_STAMP");
    }

}
