package com.ai.da.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;

@AllArgsConstructor
@Getter
public enum CreditsEventsEnum {

    PRICE("price","10"),
//    PRICE("price","1"),// for test
//    PRICE("price","0.1"),

    BUY_CREDITS("Buy Credits","50"),
//    BUY_CREDITS("Buy Credits","10"),// for test

    REFUND("Refund","50"),
//    BUY_CREDITS("Buy Credits","10"),

    // 每月更新
    INIT_YEARLY("init_yearly", "50000"),
    INIT_MONTHLY("init_monthly", "3500"),
    INIT_MONTHLY_ECO("init_monthly_eco", "500"),
    INIT_QUARTERLY("init_quarterly", "12000"),
    INIT_MONTHLY_EDU("init_monthly_edu", "3500"),
    INIT_TRIAL("init_trial", "100"),
    INIT_WEEKLY("init_weekly","6000"),
    RESET_YEAR_CREDITS("reset_year_credits","6000"),

//    SUPER_RESOLUTION("Super Resolution","30"),
    SUPER_RESOLUTION("Super Resolution","10"),
    SLOGAN("Slogan","10"),
    LOGO("Logo","5"),
    PATTERN("Pattern","5"),
    MOOD_BOARD("MoodBoard","5"),
    SKETCH_BOARD("SketchBoard","5"),
    TO_PRODUCT_IMAGE("ToProductImage","5"),
    TO_PRODUCT_IMAGE_ADVANCED("ToProductImageAdvanced","15"),
    RELIGHT("Relight","5"),
    RELIGHT_FLUX("RelightFlux","10"),
    QUESTIONNAIRE("Questionnaire","100"),
    IMAGE_TO_SKETCH("ImageToSketch","5"),
    IMAGE_TO_SKETCH_FLUX("ImageToSketchFlux","10"),
    POSE_TRANSFORMATION("PoseTransformation","10"),
    OTHER("Other","5"),

    SCETCH_TEXT2IMG("SketchText2Image","10"),
    SCETCH_IMG2IMG("SketchImg2Image","15"),
    WX_TEXT2IMG("WX_Text2Image", "5"),
    QWEN_TEXT2IMG("QWEN_Text2Image", "10"),
    DOUBAO_TEXT2IMG("Doubao_Text2Image", "10"),
    DOUBAO_IMG2IMG_ADVANCED("Doubao_img2image_advanced", "10"),
    DOUBAO_IMG2IMG_HIGH("Doubao_img2image_high", "15"),
    WX_ANIMATION("WX_Animation", "30"),
    FREEPIK_IMG2IMG("Freepik_img2img", "20"),
    FLUX_IMG2IMG("Flux_img2img","10"),

    LOCAL_TEXT2IMG("Local_text2img","1.25"),
    LOCAL_IMG2IMG("Local_img2img","1.25"),
    LOCAL_TEXT2IMG_HIGH("Local_text2img_high","5"),
    LOCAL_IMG2IMG_HIGH("Local_img2img_high","5"),
    LOCAL_ANIMATION("Local_Animation","15"),

    LLM_CONVERSATION("LLM_Conversation", "0")
    ;

    private final String name;

    /**
     * 对应事件需要消耗or获得的积分
     */
    private final String value;

    public static List<String> generateFunctionNames() {
        return Arrays.asList(SLOGAN.name, LOGO.name, PATTERN.name, MOOD_BOARD.name, SKETCH_BOARD.name,
                TO_PRODUCT_IMAGE.name, RELIGHT.name, IMAGE_TO_SKETCH.name, POSE_TRANSFORMATION.name);
    }

    private static final Map<String, CreditsEventsEnum> BY_TASK_NAME = Arrays.stream(values())
            .collect(Collectors.toMap(CreditsEventsEnum::getName, Function.identity()));

    public static CreditsEventsEnum getByTaskName(String taskName){
        return BY_TASK_NAME.get(taskName);
    }
}
