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

// @formatter:off
import java.util.Date;

import android.content.Context;
import android.content.ContentResolver;
import android.net.Uri;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

import com.kfzs.duanduan.datashare.provider.base.AbstractContentValues;

/**
 * Content values wrapper for the {@code downloadtask} table.
 */
@SuppressWarnings({"ConstantConditions", "unused"})
public class DownloadtaskContentValues extends AbstractContentValues {
    @Override
    public Uri uri() {
        return DownloadtaskColumns.CONTENT_URI;
    }

    /**
     * Update row(s) using the values stored by this object and the given selection.
     *
     * @param contentResolver The content resolver to use.
     * @param where The selection to use (can be {@code null}).
     */
    public int update(ContentResolver contentResolver, @Nullable DownloadtaskSelection where) {
        return contentResolver.update(uri(), values(), where == null ? null : where.sel(), where == null ? null : where.args());
    }

    /**
     * Update row(s) using the values stored by this object and the given selection.
     *
     * @param context The context to use.
     * @param where The selection to use (can be {@code null}).
     */
    public int update(Context context, @Nullable DownloadtaskSelection where) {
        return context.getContentResolver().update(uri(), values(), where == null ? null : where.sel(), where == null ? null : where.args());
    }

    /**
     * update create_time of this download_task.
     */
    public DownloadtaskContentValues putCreateTime(long value) {
        mContentValues.put(DownloadtaskColumns.CREATE_TIME, value);
        return this;
    }


    /**
     * download_task_id of this download_task.
     */
    public DownloadtaskContentValues putDownloadTaskId(@Nullable Integer value) {
        mContentValues.put(DownloadtaskColumns.DOWNLOAD_TASK_ID, value);
        return this;
    }

    public DownloadtaskContentValues putDownloadTaskIdNull() {
        mContentValues.putNull(DownloadtaskColumns.DOWNLOAD_TASK_ID);
        return this;
    }

    /**
     * game_name of this download_task.
     */
    public DownloadtaskContentValues putGameName(@NonNull String value) {
        if (value == null) throw new IllegalArgumentException("gameName must not be null");
        mContentValues.put(DownloadtaskColumns.GAME_NAME, value);
        return this;
    }


    /**
     * icon_url of this download_task.
     */
    public DownloadtaskContentValues putIconUrl(@NonNull String value) {
        if (value == null) throw new IllegalArgumentException("iconUrl must not be null");
        mContentValues.put(DownloadtaskColumns.ICON_URL, value);
        return this;
    }


    /**
     * percent of this download_task.
     */
    public DownloadtaskContentValues putPercent(@Nullable Integer value) {
        mContentValues.put(DownloadtaskColumns.PERCENT, value);
        return this;
    }

    public DownloadtaskContentValues putPercentNull() {
        mContentValues.putNull(DownloadtaskColumns.PERCENT);
        return this;
    }

    /**
     * downloaded_size of this download_task.
     */
    public DownloadtaskContentValues putDownloadedSize(@Nullable Double value) {
        mContentValues.put(DownloadtaskColumns.DOWNLOADED_SIZE, value);
        return this;
    }

    public DownloadtaskContentValues putDownloadedSizeNull() {
        mContentValues.putNull(DownloadtaskColumns.DOWNLOADED_SIZE);
        return this;
    }

    /**
     * total_size of this download_task.
     */
    public DownloadtaskContentValues putTotalSize(@Nullable Double value) {
        mContentValues.put(DownloadtaskColumns.TOTAL_SIZE, value);
        return this;
    }

    public DownloadtaskContentValues putTotalSizeNull() {
        mContentValues.putNull(DownloadtaskColumns.TOTAL_SIZE);
        return this;
    }

    /**
     * status of this download_task.
     */
    public DownloadtaskContentValues putStatus(int value) {
        mContentValues.put(DownloadtaskColumns.STATUS, value);
        return this;
    }


    /**
     * download_url of this download_task.
     */
    public DownloadtaskContentValues putDownloadUrl(@NonNull String value) {
        if (value == null) throw new IllegalArgumentException("downloadUrl must not be null");
        mContentValues.put(DownloadtaskColumns.DOWNLOAD_URL, value);
        return this;
    }


    /**
     * package_name of this download_task.
     */
    public DownloadtaskContentValues putPackageName(@NonNull String value) {
        if (value == null) throw new IllegalArgumentException("packageName must not be null");
        mContentValues.put(DownloadtaskColumns.PACKAGE_NAME, value);
        return this;
    }


    /**
     * version_code of this download_task.
     */
    public DownloadtaskContentValues putVersionCode(int value) {
        mContentValues.put(DownloadtaskColumns.VERSION_CODE, value);
        return this;
    }


    /**
     * apk_path of this download_task.
     */
    public DownloadtaskContentValues putApkPath(@NonNull String value) {
        if (value == null) throw new IllegalArgumentException("apkPath must not be null");
        mContentValues.put(DownloadtaskColumns.APK_PATH, value);
        return this;
    }

}
