package com.kfzs.duanduan.data.graph.provider.user;

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

import android.content.Context;
import android.content.ContentResolver;
import android.database.Cursor;
import android.net.Uri;
import android.support.v4.content.CursorLoader;

import com.kfzs.duanduan.data.graph.provider.base.AbstractSelection;

/**
 * Selection for the {@code user} table.
 */
@SuppressWarnings({"unused", "WeakerAccess", "Recycle"})
public class UserSelection extends AbstractSelection<UserSelection> {
    @Override
    protected Uri baseUri() {
        return UserColumns.CONTENT_URI;
    }

    /**
     * Query the given content resolver using this selection.
     *
     * @param contentResolver The content resolver to query.
     * @param projection A list of which columns to return. Passing null will return all columns, which is inefficient.
     * @return A {@code UserCursor} object, which is positioned before the first entry, or null.
     */
    public UserCursor query(ContentResolver contentResolver, String[] projection) {
        Cursor cursor = contentResolver.query(uri(), projection, sel(), args(), order());
        if (cursor == null) return null;
        return new UserCursor(cursor);
    }

    /**
     * Equivalent of calling {@code query(contentResolver, null)}.
     */
    public UserCursor query(ContentResolver contentResolver) {
        return query(contentResolver, null);
    }

    /**
     * Query the given content resolver using this selection.
     *
     * @param context The context to use for the query.
     * @param projection A list of which columns to return. Passing null will return all columns, which is inefficient.
     * @return A {@code UserCursor} object, which is positioned before the first entry, or null.
     */
    public UserCursor query(Context context, String[] projection) {
        Cursor cursor = context.getContentResolver().query(uri(), projection, sel(), args(), order());
        if (cursor == null) return null;
        return new UserCursor(cursor);
    }

    /**
     * Equivalent of calling {@code query(context, null)}.
     */
    public UserCursor query(Context context) {
        return query(context, null);
    }


    /**
     * {@inheritDoc}
     */
    @Override
    public CursorLoader getCursorLoader(Context context, String[] projection) {
        return new CursorLoader(context, uri(), projection, sel(), args(), order()) {
            @Override
            public Cursor loadInBackground() {
                return new UserCursor(super.loadInBackground());
            }
        };
    }


    public UserSelection id(long... value) {
        addEquals("user." + UserColumns._ID, toObjectArray(value));
        return this;
    }

    public UserSelection idNot(long... value) {
        addNotEquals("user." + UserColumns._ID, toObjectArray(value));
        return this;
    }

    public UserSelection orderById(boolean desc) {
        orderBy("user." + UserColumns._ID, desc);
        return this;
    }

    public UserSelection orderById() {
        return orderById(false);
    }

    public UserSelection uid(int... value) {
        addEquals(UserColumns.UID, toObjectArray(value));
        return this;
    }

    public UserSelection uidNot(int... value) {
        addNotEquals(UserColumns.UID, toObjectArray(value));
        return this;
    }

    public UserSelection uidGt(int value) {
        addGreaterThan(UserColumns.UID, value);
        return this;
    }

    public UserSelection uidGtEq(int value) {
        addGreaterThanOrEquals(UserColumns.UID, value);
        return this;
    }

    public UserSelection uidLt(int value) {
        addLessThan(UserColumns.UID, value);
        return this;
    }

    public UserSelection uidLtEq(int value) {
        addLessThanOrEquals(UserColumns.UID, value);
        return this;
    }

    public UserSelection orderByUid(boolean desc) {
        orderBy(UserColumns.UID, desc);
        return this;
    }

    public UserSelection orderByUid() {
        orderBy(UserColumns.UID, false);
        return this;
    }

    public UserSelection userName(String... value) {
        addEquals(UserColumns.USER_NAME, value);
        return this;
    }

    public UserSelection userNameNot(String... value) {
        addNotEquals(UserColumns.USER_NAME, value);
        return this;
    }

    public UserSelection userNameLike(String... value) {
        addLike(UserColumns.USER_NAME, value);
        return this;
    }

    public UserSelection userNameContains(String... value) {
        addContains(UserColumns.USER_NAME, value);
        return this;
    }

    public UserSelection userNameStartsWith(String... value) {
        addStartsWith(UserColumns.USER_NAME, value);
        return this;
    }

    public UserSelection userNameEndsWith(String... value) {
        addEndsWith(UserColumns.USER_NAME, value);
        return this;
    }

    public UserSelection orderByUserName(boolean desc) {
        orderBy(UserColumns.USER_NAME, desc);
        return this;
    }

    public UserSelection orderByUserName() {
        orderBy(UserColumns.USER_NAME, false);
        return this;
    }

    public UserSelection updateTime(long... value) {
        addEquals(UserColumns.UPDATE_TIME, toObjectArray(value));
        return this;
    }

    public UserSelection updateTimeNot(long... value) {
        addNotEquals(UserColumns.UPDATE_TIME, toObjectArray(value));
        return this;
    }

    public UserSelection updateTimeGt(long value) {
        addGreaterThan(UserColumns.UPDATE_TIME, value);
        return this;
    }

    public UserSelection updateTimeGtEq(long value) {
        addGreaterThanOrEquals(UserColumns.UPDATE_TIME, value);
        return this;
    }

    public UserSelection updateTimeLt(long value) {
        addLessThan(UserColumns.UPDATE_TIME, value);
        return this;
    }

    public UserSelection updateTimeLtEq(long value) {
        addLessThanOrEquals(UserColumns.UPDATE_TIME, value);
        return this;
    }

    public UserSelection orderByUpdateTime(boolean desc) {
        orderBy(UserColumns.UPDATE_TIME, desc);
        return this;
    }

    public UserSelection orderByUpdateTime() {
        orderBy(UserColumns.UPDATE_TIME, false);
        return this;
    }

    public UserSelection phone(String... value) {
        addEquals(UserColumns.PHONE, value);
        return this;
    }

    public UserSelection phoneNot(String... value) {
        addNotEquals(UserColumns.PHONE, value);
        return this;
    }

    public UserSelection phoneLike(String... value) {
        addLike(UserColumns.PHONE, value);
        return this;
    }

    public UserSelection phoneContains(String... value) {
        addContains(UserColumns.PHONE, value);
        return this;
    }

    public UserSelection phoneStartsWith(String... value) {
        addStartsWith(UserColumns.PHONE, value);
        return this;
    }

    public UserSelection phoneEndsWith(String... value) {
        addEndsWith(UserColumns.PHONE, value);
        return this;
    }

    public UserSelection orderByPhone(boolean desc) {
        orderBy(UserColumns.PHONE, desc);
        return this;
    }

    public UserSelection orderByPhone() {
        orderBy(UserColumns.PHONE, false);
        return this;
    }

    public UserSelection nickname(String... value) {
        addEquals(UserColumns.NICKNAME, value);
        return this;
    }

    public UserSelection nicknameNot(String... value) {
        addNotEquals(UserColumns.NICKNAME, value);
        return this;
    }

    public UserSelection nicknameLike(String... value) {
        addLike(UserColumns.NICKNAME, value);
        return this;
    }

    public UserSelection nicknameContains(String... value) {
        addContains(UserColumns.NICKNAME, value);
        return this;
    }

    public UserSelection nicknameStartsWith(String... value) {
        addStartsWith(UserColumns.NICKNAME, value);
        return this;
    }

    public UserSelection nicknameEndsWith(String... value) {
        addEndsWith(UserColumns.NICKNAME, value);
        return this;
    }

    public UserSelection orderByNickname(boolean desc) {
        orderBy(UserColumns.NICKNAME, desc);
        return this;
    }

    public UserSelection orderByNickname() {
        orderBy(UserColumns.NICKNAME, false);
        return this;
    }

    public UserSelection userIcon(String... value) {
        addEquals(UserColumns.USER_ICON, value);
        return this;
    }

    public UserSelection userIconNot(String... value) {
        addNotEquals(UserColumns.USER_ICON, value);
        return this;
    }

    public UserSelection userIconLike(String... value) {
        addLike(UserColumns.USER_ICON, value);
        return this;
    }

    public UserSelection userIconContains(String... value) {
        addContains(UserColumns.USER_ICON, value);
        return this;
    }

    public UserSelection userIconStartsWith(String... value) {
        addStartsWith(UserColumns.USER_ICON, value);
        return this;
    }

    public UserSelection userIconEndsWith(String... value) {
        addEndsWith(UserColumns.USER_ICON, value);
        return this;
    }

    public UserSelection orderByUserIcon(boolean desc) {
        orderBy(UserColumns.USER_ICON, desc);
        return this;
    }

    public UserSelection orderByUserIcon() {
        orderBy(UserColumns.USER_ICON, false);
        return this;
    }

    public UserSelection avatar(String... value) {
        addEquals(UserColumns.AVATAR, value);
        return this;
    }

    public UserSelection avatarNot(String... value) {
        addNotEquals(UserColumns.AVATAR, value);
        return this;
    }

    public UserSelection avatarLike(String... value) {
        addLike(UserColumns.AVATAR, value);
        return this;
    }

    public UserSelection avatarContains(String... value) {
        addContains(UserColumns.AVATAR, value);
        return this;
    }

    public UserSelection avatarStartsWith(String... value) {
        addStartsWith(UserColumns.AVATAR, value);
        return this;
    }

    public UserSelection avatarEndsWith(String... value) {
        addEndsWith(UserColumns.AVATAR, value);
        return this;
    }

    public UserSelection orderByAvatar(boolean desc) {
        orderBy(UserColumns.AVATAR, desc);
        return this;
    }

    public UserSelection orderByAvatar() {
        orderBy(UserColumns.AVATAR, false);
        return this;
    }

    public UserSelection openId(String... value) {
        addEquals(UserColumns.OPEN_ID, value);
        return this;
    }

    public UserSelection openIdNot(String... value) {
        addNotEquals(UserColumns.OPEN_ID, value);
        return this;
    }

    public UserSelection openIdLike(String... value) {
        addLike(UserColumns.OPEN_ID, value);
        return this;
    }

    public UserSelection openIdContains(String... value) {
        addContains(UserColumns.OPEN_ID, value);
        return this;
    }

    public UserSelection openIdStartsWith(String... value) {
        addStartsWith(UserColumns.OPEN_ID, value);
        return this;
    }

    public UserSelection openIdEndsWith(String... value) {
        addEndsWith(UserColumns.OPEN_ID, value);
        return this;
    }

    public UserSelection orderByOpenId(boolean desc) {
        orderBy(UserColumns.OPEN_ID, desc);
        return this;
    }

    public UserSelection orderByOpenId() {
        orderBy(UserColumns.OPEN_ID, false);
        return this;
    }

    public UserSelection mail(String... value) {
        addEquals(UserColumns.MAIL, value);
        return this;
    }

    public UserSelection mailNot(String... value) {
        addNotEquals(UserColumns.MAIL, value);
        return this;
    }

    public UserSelection mailLike(String... value) {
        addLike(UserColumns.MAIL, value);
        return this;
    }

    public UserSelection mailContains(String... value) {
        addContains(UserColumns.MAIL, value);
        return this;
    }

    public UserSelection mailStartsWith(String... value) {
        addStartsWith(UserColumns.MAIL, value);
        return this;
    }

    public UserSelection mailEndsWith(String... value) {
        addEndsWith(UserColumns.MAIL, value);
        return this;
    }

    public UserSelection orderByMail(boolean desc) {
        orderBy(UserColumns.MAIL, desc);
        return this;
    }

    public UserSelection orderByMail() {
        orderBy(UserColumns.MAIL, false);
        return this;
    }

    public UserSelection refreshToken(String... value) {
        addEquals(UserColumns.REFRESH_TOKEN, value);
        return this;
    }

    public UserSelection refreshTokenNot(String... value) {
        addNotEquals(UserColumns.REFRESH_TOKEN, value);
        return this;
    }

    public UserSelection refreshTokenLike(String... value) {
        addLike(UserColumns.REFRESH_TOKEN, value);
        return this;
    }

    public UserSelection refreshTokenContains(String... value) {
        addContains(UserColumns.REFRESH_TOKEN, value);
        return this;
    }

    public UserSelection refreshTokenStartsWith(String... value) {
        addStartsWith(UserColumns.REFRESH_TOKEN, value);
        return this;
    }

    public UserSelection refreshTokenEndsWith(String... value) {
        addEndsWith(UserColumns.REFRESH_TOKEN, value);
        return this;
    }

    public UserSelection orderByRefreshToken(boolean desc) {
        orderBy(UserColumns.REFRESH_TOKEN, desc);
        return this;
    }

    public UserSelection orderByRefreshToken() {
        orderBy(UserColumns.REFRESH_TOKEN, false);
        return this;
    }
}
