package com.kfzs.duanduan.datashare.provider.downloadtask;

// @formatter:off

import android.database.Cursor;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

import com.kfzs.duanduan.datashare.provider.base.AbstractCursor;
import com.kfzs.duanduan.datashare.provider.download.DownLoadInfoDao;

/**
 * Cursor wrapper for the {@code downloadtask} table.
 */
@SuppressWarnings({"WeakerAccess", "unused", "UnnecessaryLocalVariable"})
public class DownloadtaskCursor extends AbstractCursor implements DownloadtaskModel {
    public DownloadtaskCursor(Cursor cursor) {
        super(cursor);
    }

    /**
     * Primary key.
     */
    @Override
    public long getId() {
        Long res = getLongOrNull(DownLoadInfoDao.Properties.MId.columnName);
        if (res == null)
            throw new NullPointerException("The value of '_id' in the database was null, which is not allowed according to the model definition");
        return res;
    }

    /**
     * update create_time of this download_task.
     */
    @Override
    public long getCreateTime() {
        Long res = getLongOrNull(DownLoadInfoDao.Properties.MCreateTime.columnName);
        if (res == null)
            throw new NullPointerException("The value of 'create_time' in the database was null, which is not allowed according to the model definition");
        return res;
    }

    /**
     * download_task_id of this download_task.
     * Can be {@code null}.
     */
    @Nullable
    @Override
    public Integer getDownloadTaskId() {
        Integer res = getIntegerOrNull(DownLoadInfoDao.Properties.MDownloadTaskId.columnName);
        return res;
    }

    /**
     * game_name of this download_task.
     * Cannot be {@code null}.
     */
    @NonNull
    @Override
    public String getGameName() {
        String res = getStringOrNull(DownLoadInfoDao.Properties.MGameName.columnName);
        if (res == null)
            throw new NullPointerException("The value of 'game_name' in the database was null, which is not allowed according to the model definition");
        return res;
    }

    /**
     * icon_url of this download_task.
     * Cannot be {@code null}.
     */
    @NonNull
    @Override
    public String getIconUrl() {
        String res = getStringOrNull(DownLoadInfoDao.Properties.MIconUrl.columnName);
        if (res == null)
            throw new NullPointerException("The value of 'icon_url' in the database was null, which is not allowed according to the model definition");
        return res;
    }

    /**
     * percent of this download_task.
     * Can be {@code null}.
     */
    @Nullable
    @Override
    public Integer getPercent() {
        Integer res = getIntegerOrNull(DownLoadInfoDao.Properties.MPercent.columnName);
        return res;
    }

    /**
     * downloaded_size of this download_task.
     * Can be {@code null}.
     */
    @Nullable
    @Override
    public Double getDownloadedSize() {
        Double res = getDoubleOrNull(DownLoadInfoDao.Properties.MDownloadedSize.columnName);
        return res;
    }

    /**
     * total_size of this download_task.
     * Can be {@code null}.
     */
    @Nullable
    @Override
    public Double getTotalSize() {
        Double res = getDoubleOrNull(DownLoadInfoDao.Properties.MTotalSize.columnName);
        return res;
    }

    /**
     * status of this download_task.
     */
    @Override
    public int getStatus() {
        Integer res = getIntegerOrNull(DownLoadInfoDao.Properties.MStatus.columnName);
        if (res == null)
            throw new NullPointerException("The value of 'status' in the database was null, which is not allowed according to the model definition");
        return res;
    }

    /**
     * download_url of this download_task.
     * Cannot be {@code null}.
     */
    @NonNull
    @Override
    public String getDownloadUrl() {
        String res = getStringOrNull(DownLoadInfoDao.Properties.MDownloadUrl.columnName);
        if (res == null)
            throw new NullPointerException("The value of 'download_url' in the database was null, which is not allowed according to the model definition");
        return res;
    }

    /**
     * package_name of this download_task.
     * Cannot be {@code null}.
     */
    @NonNull
    @Override
    public String getPackageName() {
        String res = getStringOrNull(DownLoadInfoDao.Properties.MPackageName.columnName);
        if (res == null)
            throw new NullPointerException("The value of 'package_name' in the database was null, which is not allowed according to the model definition");
        return res;
    }

    /**
     * version_code of this download_task.
     */
    @Override
    public int getVersionCode() {
        Integer res = getIntegerOrNull(DownLoadInfoDao.Properties.MVersionCode.columnName);
        if (res == null)
            throw new NullPointerException("The value of 'version_code' in the database was null, which is not allowed according to the model definition");
        return res;
    }

    /**
     * apk_path of this download_task.
     * Cannot be {@code null}.
     */
    @NonNull
    @Override
    public String getApkPath() {
        String res = getStringOrNull(DownLoadInfoDao.Properties.MApkPath.columnName);
        if (res == null)
            throw new NullPointerException("The value of 'apk_path' in the database was null, which is not allowed according to the model definition");
        return res;
    }

    /**
     * apk_path of this download_task.
     * Cannot be {@code null}.
     */
    @NonNull
    @Override
    public String getGameId() {
        String res = getStringOrNull(DownLoadInfoDao.Properties.MGameID.columnName);
        if (res == null)
            throw new NullPointerException("The value of 'game_id' in the database was null, which is not allowed according to the model definition");
        return res;
    }
}
