package com.huiju.estateagents.common;

/**
 * 小程序页面枚举
 *
 * @author gusy
 * @date 2020/5/21 15:58
 */
public enum MiniAppPageEnum {

    /**
     * 项目
     */
    PROJECT("project", "id=%s&targetType=%S&channelId=%s&qrCodeId=%s&buildingId=%s", "pages/project/detail/index"),

    /**
     * 报名活动
     */
    ACTIVITY("activity", "id=%s&targetType=%S&channelId=%s&qrCodeId=%s&buildingId=%s", "pages/activity/detail/index"),

    /**
     * 助力活动
     */
    HELP("help", "id=%s&targetType=%S&channelId=%s&qrCodeId=%s&buildingId=%s", "pages/activity/detail/assistance"),

    /**
     * 拼团活动
     */
    GROUP("group", "id=%s&targetType=%S&channelId=%s&qrCodeId=%s&buildingId=%s", "pages/activity/detail/assemble"),

    /**
     * h5活动
     */
    H5("h5", "id=%s&targetType=%S&channelId=%s&qrCodeId=%s&buildingId=%s", "pages/project/h5Page"),

    /**
     * 直播活动
     */
    LIVE("live", "id=%s&targetType=%S&channelId=%s&qrCodeId=%s&buildingId=%s", "onlineSelling/pages/live/index"),

    /**
     * 资讯
     */
    NEWS("news", "id=%s&targetType=%S&channelId=%s&qrCodeId=%s&buildingId=%s", "pages/news/detail/index"),

    /**
     * 在线选房
     */
    SALESBATCH("salesBatch", "id=%s&targetType=%S&channelId=%s&qrCodeId=%s&buildingId=%s", "onlineSelling/pages/houseList/index");

    private String type;
    private String scene;
    private String page;

    MiniAppPageEnum(String type, String scene, String page) {
        this.type = type;
        this.scene = scene;
        this.page = page;
    }

    public String getType() {
        return type;
    }

    public String getScene() {
        return scene;
    }

    public String getPage() {
        return page;
    }

    public static String getSceneByType(String type) {
        for (MiniAppPageEnum pageEnum : MiniAppPageEnum.values()) {
            if (type.equals(pageEnum.getType())) {
                return pageEnum.getScene();
            }
        }
        return null;
    }

    public static String getPageByType(String type) {
        for (MiniAppPageEnum pageEnum : MiniAppPageEnum.values()) {
            if (type.equals(pageEnum.getType())) {
                return pageEnum.getPage();
            }
        }
        return null;
    }
}
