59 lines
810 B
Go
59 lines
810 B
Go
|
|
package product
|
||
|
|
|
||
|
|
type ProductStatus string
|
||
|
|
|
||
|
|
const (
|
||
|
|
Active ProductStatus = "Active"
|
||
|
|
Inactive ProductStatus = "Inactive"
|
||
|
|
)
|
||
|
|
|
||
|
|
func (b ProductStatus) toString() string {
|
||
|
|
return string(b)
|
||
|
|
}
|
||
|
|
|
||
|
|
type ProductType string
|
||
|
|
|
||
|
|
const (
|
||
|
|
Food ProductType = "FOOD"
|
||
|
|
Beverage ProductType = "BEVERAGE"
|
||
|
|
)
|
||
|
|
|
||
|
|
func (b ProductType) toString() string {
|
||
|
|
return string(b)
|
||
|
|
}
|
||
|
|
|
||
|
|
type ProductStock string
|
||
|
|
|
||
|
|
const (
|
||
|
|
Available ProductStock = "AVAILABLE"
|
||
|
|
Unavailable ProductStock = "UNAVAILABLE"
|
||
|
|
)
|
||
|
|
|
||
|
|
func (b ProductStock) toString() string {
|
||
|
|
return string(b)
|
||
|
|
}
|
||
|
|
|
||
|
|
func (i *ProductStock) IsAvailable() bool {
|
||
|
|
if i == nil {
|
||
|
|
return false
|
||
|
|
}
|
||
|
|
|
||
|
|
if *i == Available {
|
||
|
|
return true
|
||
|
|
}
|
||
|
|
|
||
|
|
return false
|
||
|
|
}
|
||
|
|
|
||
|
|
func (i *ProductStock) IsUnavailable() bool {
|
||
|
|
if i == nil {
|
||
|
|
return false
|
||
|
|
}
|
||
|
|
|
||
|
|
if *i == Unavailable {
|
||
|
|
return true
|
||
|
|
}
|
||
|
|
|
||
|
|
return false
|
||
|
|
}
|