package user

import (
	"eta/eta_mini_ht_api/models"
)

type AreaCode struct {
	CodeName  string `gorm:"type:varchar(10);default:null"`
	CodeValue string `gorm:"type:varchar(10);default:null"`
	Enable    bool   `gorm:"type:tinyint(1);default:1"`
}

func GetAreaCodes() (list []AreaCode, err error) {
	db := models.Main()
	err = db.Model(&AreaCode{}).Find(&list).Error
	return
}

func GetValidAreaCodes() (list []AreaCode, err error) {
	db := models.Main()
	err = db.Model(&AreaCode{}).Where("enable = ?", true).Find(&list).Error
	return
}
