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

// @formatter:off

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

import java.util.Date;

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

/**
 * A download_task info which is part of a team.
 */
@SuppressWarnings({"WeakerAccess", "unused", "ConstantConditions"})
public class DownloadtaskBean implements DownloadtaskModel {
    private long mId;
    private long mCreateTime;
    private Integer mDownloadTaskId;
    private String mGameName;
    private String mIconUrl;
    private Integer mPercent;
    private String mGameID;
    private Double mDownloadedSize;
    private Double mTotalSize;
    private int mStatus;
    private String mDownloadUrl;
    private String mPackageName;
    private int mVersionCode;
    private String mApkPath;


    /**
     * game id
     */
    public String getmGameID() {
        return mGameID;
    }

    /**
     * update game id of this download_task
     *
     * @param mGameID
     */
    public void setmGameID(String mGameID) {
        this.mGameID = mGameID;
    }

    /**
     * Primary key.
     */
    @Override
    public long getId() {
        return mId;
    }

    /**
     * Primary key.
     */
    public void setId(long id) {
        mId = id;
    }

    /**
     * update create_time of this download_task.
     */
    @Override
    public long getCreateTime() {
        return mCreateTime;
    }

    /**
     * update create_time of this download_task.
     */
    public void setCreateTime(long createTime) {
        mCreateTime = createTime;
    }

    /**
     * download_task_id of this download_task.
     * Can be {@code null}.
     */
    @Nullable
    @Override
    public Integer getDownloadTaskId() {
        return mDownloadTaskId;
    }

    /**
     * download_task_id of this download_task.
     * Can be {@code null}.
     */
    public void setDownloadTaskId(@Nullable Integer downloadTaskId) {
        mDownloadTaskId = downloadTaskId;
    }

    /**
     * game_name of this download_task.
     * Cannot be {@code null}.
     */
    @NonNull
    @Override
    public String getGameName() {
        return mGameName;
    }

    /**
     * game_name of this download_task.
     * Must not be {@code null}.
     */
    public void setGameName(@NonNull String gameName) {
        if (gameName == null)
            throw new IllegalArgumentException("gameName must not be null");
        mGameName = gameName;
    }

    /**
     * icon_url of this download_task.
     * Cannot be {@code null}.
     */
    @NonNull
    @Override
    public String getIconUrl() {
        return mIconUrl;
    }

    /**
     * icon_url of this download_task.
     * Must not be {@code null}.
     */
    public void setIconUrl(@NonNull String iconUrl) {
        if (iconUrl == null)
            throw new IllegalArgumentException("iconUrl must not be null");
        mIconUrl = iconUrl;
    }

    /**
     * percent of this download_task.
     * Can be {@code null}.
     */
    @Nullable
    @Override
    public Integer getPercent() {
        return mPercent;
    }

    /**
     * percent of this download_task.
     * Can be {@code null}.
     */
    public void setPercent(@Nullable Integer percent) {
        mPercent = percent;
    }

    /**
     * downloaded_size of this download_task.
     * Can be {@code null}.
     */
    @Nullable
    @Override
    public Double getDownloadedSize() {
        return mDownloadedSize;
    }

    /**
     * downloaded_size of this download_task.
     * Can be {@code null}.
     */
    public void setDownloadedSize(@Nullable Double downloadedSize) {
        mDownloadedSize = downloadedSize;
    }

    /**
     * total_size of this download_task.
     * Can be {@code null}.
     */
    @Nullable
    @Override
    public Double getTotalSize() {
        return mTotalSize;
    }

    /**
     * total_size of this download_task.
     * Can be {@code null}.
     */
    public void setTotalSize(@Nullable Double totalSize) {
        mTotalSize = totalSize;
    }

    /**
     * status of this download_task.
     */
    @Override
    public int getStatus() {
        return mStatus;
    }

    /**
     * status of this download_task.
     */
    public void setStatus(int status) {
        mStatus = status;
    }

    /**
     * download_url of this download_task.
     * Cannot be {@code null}.
     */
    @NonNull
    @Override
    public String getDownloadUrl() {
        return mDownloadUrl;
    }

    /**
     * download_url of this download_task.
     * Must not be {@code null}.
     */
    public void setDownloadUrl(@NonNull String downloadUrl) {
        if (downloadUrl == null)
            throw new IllegalArgumentException("downloadUrl must not be null");
        mDownloadUrl = downloadUrl;
    }

    /**
     * package_name of this download_task.
     * Cannot be {@code null}.
     */
    @NonNull
    @Override
    public String getPackageName() {
        return mPackageName;
    }

    /**
     * package_name of this download_task.
     * Must not be {@code null}.
     */
    public void setPackageName(@NonNull String packageName) {
        if (packageName == null)
            throw new IllegalArgumentException("packageName must not be null");
        mPackageName = packageName;
    }

    /**
     * version_code of this download_task.
     */
    @Override
    public int getVersionCode() {
        return mVersionCode;
    }

    /**
     * version_code of this download_task.
     */
    public void setVersionCode(int versionCode) {
        mVersionCode = versionCode;
    }

    /**
     * apk_path of this download_task.
     * Cannot be {@code null}.
     */
    @NonNull
    @Override
    public String getApkPath() {
        return mApkPath;
    }

    @NonNull
    @Override
    public String getGameId() {
        return mGameID;
    }

    /**
     * apk_path of this download_task.
     * Must not be {@code null}.
     */
    public void setApkPath(@NonNull String apkPath) {
        if (apkPath == null)
            throw new IllegalArgumentException("apkPath must not be null");
        mApkPath = apkPath;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o)
            return true;
        if (o == null || getClass() != o.getClass())
            return false;
        DownloadtaskBean bean = (DownloadtaskBean) o;
        return mId == bean.mId;
    }

    @Override
    public int hashCode() {
        return (int) (mId ^ (mId >>> 32));
    }

    /**
     * Instantiate a new DownloadtaskBean with specified values.
     */
    @NonNull
    public static DownloadtaskBean newInstance(long id, long createTime, @Nullable Integer downloadTaskId, @NonNull String gameName, @NonNull String iconUrl, @Nullable Integer percent, @Nullable Double downloadedSize, @Nullable Double totalSize, int status, @NonNull String downloadUrl, @NonNull String packageName, int versionCode, @NonNull String apkPath) {
        if (gameName == null)
            throw new IllegalArgumentException("gameName must not be null");
        if (iconUrl == null)
            throw new IllegalArgumentException("iconUrl must not be null");
        if (downloadUrl == null)
            throw new IllegalArgumentException("downloadUrl must not be null");
        if (packageName == null)
            throw new IllegalArgumentException("packageName must not be null");
        if (apkPath == null)
            throw new IllegalArgumentException("apkPath must not be null");
        DownloadtaskBean res = new DownloadtaskBean();
        res.mId = id;
        res.mCreateTime = createTime;
        res.mDownloadTaskId = downloadTaskId;
        res.mGameName = gameName;
        res.mIconUrl = iconUrl;
        res.mPercent = percent;
        res.mDownloadedSize = downloadedSize;
        res.mTotalSize = totalSize;
        res.mStatus = status;
        res.mDownloadUrl = downloadUrl;
        res.mPackageName = packageName;
        res.mVersionCode = versionCode;
        res.mApkPath = apkPath;
        return res;
    }

    /**
     * Instantiate a new DownloadtaskBean with all the values copied from the given model.
     */
    @NonNull
    public static DownloadtaskBean copy(@NonNull DownloadtaskModel from) {
        DownloadtaskBean res = new DownloadtaskBean();
        res.mId = from.getId();
        res.mCreateTime = from.getCreateTime();
        res.mDownloadTaskId = from.getDownloadTaskId();
        res.mGameName = from.getGameName();
        res.mIconUrl = from.getIconUrl();
        res.mPercent = from.getPercent();
        res.mDownloadedSize = from.getDownloadedSize();
        res.mTotalSize = from.getTotalSize();
        res.mStatus = from.getStatus();
        res.mDownloadUrl = from.getDownloadUrl();
        res.mPackageName = from.getPackageName();
        res.mVersionCode = from.getVersionCode();
        res.mApkPath = from.getApkPath();
        return res;
    }

    public static class Builder {
        private DownloadtaskBean mRes = new DownloadtaskBean();

        /**
         * Primary key.
         */
        public Builder id(long id) {
            mRes.mId = id;
            return this;
        }

        /**
         * update create_time of this download_task.
         */
        public Builder createTime(long createTime) {
            mRes.mCreateTime = createTime;
            return this;
        }

        /**
         * download_task_id of this download_task.
         * Can be {@code null}.
         */
        public Builder downloadTaskId(@Nullable Integer downloadTaskId) {
            mRes.mDownloadTaskId = downloadTaskId;
            return this;
        }

        /**
         * game_name of this download_task.
         * Must not be {@code null}.
         */
        public Builder gameName(@NonNull String gameName) {
            if (gameName == null)
                throw new IllegalArgumentException("gameName must not be null");
            mRes.mGameName = gameName;
            return this;
        }

        /**
         * icon_url of this download_task.
         * Must not be {@code null}.
         */
        public Builder iconUrl(@NonNull String iconUrl) {
            if (iconUrl == null)
                throw new IllegalArgumentException("iconUrl must not be null");
            mRes.mIconUrl = iconUrl;
            return this;
        }

        /**
         * percent of this download_task.
         * Can be {@code null}.
         */
        public Builder percent(@Nullable Integer percent) {
            mRes.mPercent = percent;
            return this;
        }

        /**
         * downloaded_size of this download_task.
         * Can be {@code null}.
         */
        public Builder downloadedSize(@Nullable Double downloadedSize) {
            mRes.mDownloadedSize = downloadedSize;
            return this;
        }

        /**
         * total_size of this download_task.
         * Can be {@code null}.
         */
        public Builder totalSize(@Nullable Double totalSize) {
            mRes.mTotalSize = totalSize;
            return this;
        }

        /**
         * status of this download_task.
         */
        public Builder status(int status) {
            mRes.mStatus = status;
            return this;
        }

        /**
         * download_url of this download_task.
         * Must not be {@code null}.
         */
        public Builder downloadUrl(@NonNull String downloadUrl) {
            if (downloadUrl == null)
                throw new IllegalArgumentException("downloadUrl must not be null");
            mRes.mDownloadUrl = downloadUrl;
            return this;
        }

        /**
         * package_name of this download_task.
         * Must not be {@code null}.
         */
        public Builder packageName(@NonNull String packageName) {
            if (packageName == null)
                throw new IllegalArgumentException("packageName must not be null");
            mRes.mPackageName = packageName;
            return this;
        }

        /**
         * version_code of this download_task.
         */
        public Builder versionCode(int versionCode) {
            mRes.mVersionCode = versionCode;
            return this;
        }

        /**
         * apk_path of this download_task.
         * Must not be {@code null}.
         */
        public Builder apkPath(@NonNull String apkPath) {
            if (apkPath == null)
                throw new IllegalArgumentException("apkPath must not be null");
            mRes.mApkPath = apkPath;
            return this;
        }

        /**
         * Get a new DownloadtaskBean built with the given values.
         */
        public DownloadtaskBean build() {
            if (mRes.mGameName == null)
                throw new IllegalArgumentException("gameName must not be null");
            if (mRes.mIconUrl == null)
                throw new IllegalArgumentException("iconUrl must not be null");
            if (mRes.mDownloadUrl == null)
                throw new IllegalArgumentException("downloadUrl must not be null");
            if (mRes.mPackageName == null)
                throw new IllegalArgumentException("packageName must not be null");
            if (mRes.mApkPath == null)
                throw new IllegalArgumentException("apkPath must not be null");
            return mRes;
        }
    }

    public static Builder newBuilder() {
        return new Builder();
    }
}
