package com.cyksj.model.entity;

import cn.hutool.core.util.StrUtil;
import lombok.Getter;
import lombok.Setter;

import java.util.stream.Stream;

/*
 *项目名: netflix
 *文件名: UserPageLanguage
 *创建者: JavaZou
 *创建时间:2022/12/7 17:41
 */
@Getter
@Setter
public class UserPageLanguage extends BaseEntity {

	private Long userId;


	private Language language;

	@Getter
	public enum Language {
		zh_CN("中文"),
		zh_HK("中文香港繁体"),
		ja_JP("日语"),
		ko_KR("韩语"),
		en_US("英文");

		String desc;

		Language(String desc) {
			this.desc = desc;
		}

		public static Boolean checkLanguage(String language) {
			if (StrUtil.isEmpty(language)) {
				return false;
			}
			return Stream.of(Language.values())
					.filter(value -> value.name().equals(language))
					.findFirst().isPresent();
		}
	}
}
