64 lines
1.2 KiB
Go
64 lines
1.2 KiB
Go
|
|
package constants
|
||
|
|
|
||
|
|
type BusinessType string
|
||
|
|
|
||
|
|
const (
|
||
|
|
BusinessTypeRestaurant BusinessType = "restaurant"
|
||
|
|
BusinessTypeRetail BusinessType = "retail"
|
||
|
|
BusinessTypeCafe BusinessType = "cafe"
|
||
|
|
BusinessTypeBar BusinessType = "bar"
|
||
|
|
)
|
||
|
|
|
||
|
|
type Currency string
|
||
|
|
|
||
|
|
const (
|
||
|
|
CurrencyUSD Currency = "USD"
|
||
|
|
CurrencyEUR Currency = "EUR"
|
||
|
|
CurrencyGBP Currency = "GBP"
|
||
|
|
CurrencyIDR Currency = "IDR"
|
||
|
|
)
|
||
|
|
|
||
|
|
const (
|
||
|
|
DefaultBusinessType = BusinessTypeRestaurant
|
||
|
|
DefaultCurrency = CurrencyUSD
|
||
|
|
DefaultTaxRate = 0.0
|
||
|
|
MaxNameLength = 255
|
||
|
|
MaxDescriptionLength = 1000
|
||
|
|
)
|
||
|
|
|
||
|
|
func GetAllBusinessTypes() []BusinessType {
|
||
|
|
return []BusinessType{
|
||
|
|
BusinessTypeRestaurant,
|
||
|
|
BusinessTypeRetail,
|
||
|
|
BusinessTypeCafe,
|
||
|
|
BusinessTypeBar,
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
func GetAllCurrencies() []Currency {
|
||
|
|
return []Currency{
|
||
|
|
CurrencyUSD,
|
||
|
|
CurrencyEUR,
|
||
|
|
CurrencyGBP,
|
||
|
|
CurrencyIDR,
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
func IsValidBusinessType(businessType BusinessType) bool {
|
||
|
|
for _, validType := range GetAllBusinessTypes() {
|
||
|
|
if businessType == validType {
|
||
|
|
return true
|
||
|
|
}
|
||
|
|
}
|
||
|
|
return false
|
||
|
|
}
|
||
|
|
|
||
|
|
func IsValidCurrency(currency Currency) bool {
|
||
|
|
for _, validCurrency := range GetAllCurrencies() {
|
||
|
|
if currency == validCurrency {
|
||
|
|
return true
|
||
|
|
}
|
||
|
|
}
|
||
|
|
return false
|
||
|
|
}
|