package config

import "github.com/zeromicro/go-zero/rest"

type MongoConf struct {
	URI            string
	Database       string
	TimeoutSeconds int `json:",default=10"`
}

type RedisConf struct {
	Addr string `json:",optional"`
	DB   int    `json:",optional"`
}

type JobWorkerConf struct {
	Enabled    bool   `json:",default=true"`
	WorkerType string `json:",default=go"`
	WorkerID   string `json:",optional"`
}

type JobSchedulerConf struct {
	Enabled         bool `json:",default=true"`
	IntervalSeconds int  `json:",default=60"`
}

type JobReaperConf struct {
	Enabled         bool `json:",default=true"`
	IntervalSeconds int  `json:",default=30"`
}

type AuthConf struct {
	AccessSecret         string `json:",optional"`
	RefreshSecret        string `json:",optional"`
	AccessExpireSeconds  int64  `json:",default=900"`
	RefreshExpireSeconds int64  `json:",default=2592000"`
	DevHeaderFallback    bool   `json:",default=true"`
}

type InternalWorkerConf struct {
	Secret string `json:",optional"`
}

type BraveConf struct {
	APIKey string `json:",optional"`
}

type Config struct {
	rest.RestConf
	Mongo          MongoConf          `json:",optional"`
	Redis          RedisConf          `json:",optional"`
	Auth           AuthConf           `json:",optional"`
	InternalWorker InternalWorkerConf `json:",optional"`
	JobWorker      JobWorkerConf      `json:",optional"`
	JobScheduler   JobSchedulerConf   `json:",optional"`
	JobReaper      JobReaperConf      `json:",optional"`
	Brave          BraveConf          `json:",optional"`
}
