package conf

type ParserConf struct {
	EnableDns       bool                 `json:"EnableDns"`
	RemoteDnsPath   string               `json:"RemoteDnsPath"`
	DnsPath         string               `json:"DnsPath"`
	EnableRoute     bool                 `json:"EnableRoute"`
	RemoteRoutePath string               `json:"RemoteRoutePath"`
	RoutePath       string               `json:"RoutePath"`
	Outbound        OutboundConf         `json:"Outbound"`
	Dns             map[string]DnsAddr   `json:"Dns"`
	MatchRuleList   map[string]MatchRule `json:"MatchRuleList"`
}

type DnsAddr struct {
	Addr string `json:"Addr"`
	Port uint16 `json:"Port"`
}

type OutboundConf struct {
	Tags               map[string]string `json:"Tags"`
	RemoteOutboundPath string            `json:"RemoteOutboundPath"`
	LocalOutboundPath  string            `json:"LocalOutboundPath"`
}

func newParserConf() ParserConf {
	return ParserConf{
		RoutePath: "/etc/V2bX/route.json",
		Dns:       map[string]DnsAddr{},
		Outbound: OutboundConf{
			Tags: map[string]string{
				"jp":     "ujp",
				"hk":     "uhk",
				"global": "ug",
			},
			RemoteOutboundPath: "",
			LocalOutboundPath:  "/etc/V2bX/outbound.json",
		},
		MatchRuleList: map[string]MatchRule{
			"Netflix": {
				Domain: []string{
					"geosite:netflix",
				},
				Ip: []string{
					"geoip:netflix",
				},
			},
			"Niconico": {
				Domain: []string{
					"geosite:niconico",
				},
			},
			"DMM": {
				Domain: []string{
					"geosite:dmm",
				},
			},
			"Abema": {
				Domain: []string{
					"geosite:abema",
				},
			},
			"music.jp": {
				Domain: []string{
					"domain:music-book.jp",
				},
			},
			"Telasa": {
				Domain: []string{
					"domain:telasa.jp",
					"domain:kddi-video.com",
					"domain:videopass.jp",
					"domain:d2lmsumy47c8as.cloudfront.net",
				},
			},
			"Paravi": {
				Domain: []string{
					"domain:paravi.jp",
				},
			},
			"U-NEXT": {
				Domain: []string{
					"domain:unext.jp",
					"domain:nxtv.jp",
				}},
			"Hulu Japan": {
				Domain: []string{
					"geosite:hulu",
				},
			},
		},
	}
}
