from peewee import AutoField, CharField, ForeignKeyField

from lib.domain.BaseModel import BaseModel
from lib.domain.Town import Town


class ZipCode(BaseModel):
    class Meta:
        table_name = "postcode"

    id = AutoField(column_name="postcodeid")
    zip_code = CharField(max_length=15, column_name="postcode")
    town = ForeignKeyField(Town, backref="zip_codes", column_name="addressid")
