package com.atlassian.bitbucket.scm;

import com.atlassian.bitbucket.repository.RefOrder;

import javax.annotation.Nullable;

public abstract class AbstractRefsCommandParameters extends AbstractCommandParameters {

    protected final String filterText;
    protected final RefOrder order;

    protected AbstractRefsCommandParameters(RefOrder order, String filterText) {
        this.order = order;
        this.filterText = filterText;
    }

    @Nullable
    public String getFilterText() {
        return filterText;
    }

    @Nullable
    public RefOrder getOrder() {
        return order;
    }

    public abstract static class AbstractBuilder<B extends AbstractBuilder<B>> {

        protected String filterText;
        protected RefOrder order;

        public AbstractBuilder() {
        }

        public B filterText(String value) {
            filterText = value;

            return self();
        }

        public B order(RefOrder value) {
            order = value;

            return self();
        }

        protected abstract B self();
    }
}
