package auth

import (
	"fmt"

	"src.rybka.ca/pkg/util"
)

func validatePhone(phone string) error {
	if len(phone) < 10 {
		return fmt.Errorf("too short: %s", phone)
	}
	if len(phone) > 10 {
		return fmt.Errorf("too long")
	}
	areaCode := phone[:3]
	if !util.CanadianAreaCodes[areaCode] {
		return fmt.Errorf("not a canadian number")
	}
	return nil
}
