package sgc.portal.base.storage;

/**
 * Subpath 구현체 중 디렉토리 관리 전략에 따라
 * 적절한 구현체를 선택하는 팩토리 클래스
 *
 * @author YongSang
 * @version 1.0.0
 * @since 2020. 9. 5.
 */
public class SubpathFactory {
    /**
     * The constant DATE_BASED_TYPE.
     */
    private static final String DATE_BASED_TYPE = "date";
    /**
     * The constant DEFAULT_TYPE.
     */
    private static final String DEFAULT_TYPE = "default";

    /**
     * Create subpath.
     *
     * @param type   the type
     * @param others the others
     * @return the subpath
     */
    public static Subpath create(String type, String[] others) {
        switch (type) {
            case DATE_BASED_TYPE:
                return new DateBasedSubpath(others);
            case DEFAULT_TYPE:
                return new DefaultSubpath(others);
            default:
                throw new UnsupportedOperationException("\"" + type + "\" is an unsupported type.");
        }
    }
}