# Path: farmsList/database.py
# class CRUDMixin(object):
# class Model(CRUDMixin, db.Model):
# class SurrogatePK(object):
#     def create(cls, **kwargs):
#     def update(self, commit=True, **kwargs):
#     def save(self, commit=True):
#     def delete(self, commit=True):
#     def get_by_id(cls, id):
# def ReferenceCol(tablename, nullable=False, pk_name='id', **kwargs):


from farmsList.database import (
    Column,
    Table,
    db,
    Model,
    ReferenceCol,
    relationship,
    SurrogatePK,
)
from sqlalchemy.ext.declarative import declarative_base
from geoalchemy2.types import Geometry
# -*- coding: utf-8 -*-

Base = declarative_base()

class Parcel(SurrogatePK, Model):
    __tablename__ = 'parcels'
    size = Column(db.Numeric(precision=6, scale=2), nullable = False)
    water = Column(db.Numeric(precision=3, scale=0), nullable=True)
    soil = Column(db.String(400), nullable=True)
    zoning = Column(db.String(80), nullable=False)
    geometry = Column(db.String(6250000), nullable=False)
    center = Column(db.String(2000), nullable=False)
    geom = Column(Geometry(geometry_type='MULTIPOLYGON'))
    cent = Column(Geometry(geometry_type='POINT'))
    developmentPlan = Column(db.String(400), nullable=True)
    restrictions = Column(db.String(400), nullable=True)
    address = Column(db.String(400), nullable=True)
    apn = Column(db.BigInteger(), nullable=False, unique=True)

# Path: farmsList/database.py
# class CRUDMixin(object):
# class Model(CRUDMixin, db.Model):
# class SurrogatePK(object):
#     def create(cls, **kwargs):
#     def update(self, commit=True, **kwargs):
#     def save(self, commit=True):
#     def delete(self, commit=True):
#     def get_by_id(cls, id):
# def ReferenceCol(tablename, nullable=False, pk_name='id', **kwargs):


# Path: farmsList/public/models.py
from farmsList.database import (
    Column,
    Table,
    db,
    Model,
    ReferenceCol,
    relationship,
    SurrogatePK,
)
from sqlalchemy.ext.declarative import declarative_base
from geoalchemy2.types import Geometry

# -*- coding: utf-8 -*-

Base = declarative_base()

class Parcel(SurrogatePK, Model):
    __tablename__ = 'parcels'
    size = Column(db.Numeric(precision=6, scale=2), nullable = False)
    water = Column(db.Numeric(precision=3, scale=0), nullable=True)
    soil = Column(db.String(400), nullable=True)
    zoning = Column(db.String(80), nullable=False)
    geometry = Column(db.String(6250000), nullable=False)
    center = Column(db.String(2000), nullable=False)
    geom = Column(Geometry(geometry_type='MULTIPOLYGON'))
    cent = Column(Geometry(geometry_type='POINT'))
    developmentPlan = Column(db.String(400), nullable=True)
    restrictions = Column(db.String(400), nullable=True)
    address = Column(db.String(400), nullable=True)
    apn = Column(db.BigInteger(), nullable=False, unique=True)

    jurisdiction = Column(db.String(400))