package com.ycwl.basic.image.watermark;

import com.ycwl.basic.image.watermark.enums.ImageWatermarkOperatorEnum;
import com.ycwl.basic.image.watermark.exception.ImageWatermarkUnsupportedException;
import com.ycwl.basic.image.watermark.operator.IOperator;
import com.ycwl.basic.image.watermark.operator.LeicaWatermarkOperator;
import com.ycwl.basic.image.watermark.operator.NormalWatermarkOperator;

public class ImageWatermarkFactory {
    public static IOperator get(String watermarkType) {
        ImageWatermarkOperatorEnum type = ImageWatermarkOperatorEnum.getByCode(watermarkType);
        if (type == null) {
            throw new ImageWatermarkUnsupportedException(watermarkType);
        }
        switch (type) {
            case NORMAL:
                return new NormalWatermarkOperator();
            case LEICA:
                return new LeicaWatermarkOperator();
            default:
                throw new ImageWatermarkUnsupportedException(watermarkType);
        }
    }
}
