# coding: utf-8
"""
class StationMetaAux (Base)
===========================

class StationMetaAuxURL (Base)
------------------------------

class StationMetaAuxDoc (Base)
------------------------------

class StationMetaAuxImage (Base)
--------------------------------
"""
from sqlalchemy import CheckConstraint, Column, DateTime, ForeignKey, Integer, String, Text, Sequence
from sqlalchemy.orm import relationship
from .models_core import StationmetaCore
from toardb.base import Base


STATIONMETA_AUX_DOC_ID_SEQ = Sequence('stationmeta_aux_doc_id_seq') #define sequence explicitly
class StationmetaAuxDoc(Base):
    """ Table "public.stationmeta_aux_doc"

    +----------------------+--------------------------+-----------+----------+-------------------------------------------------+
    |        Column        |           Type           | Collation | Nullable |                     Default                     |
    +======================+==========================+===========+==========+=================================================+
    | id                   | integer                  |           | not null | nextval('stationmeta_aux_doc_id_seq'::regclass) |
    +----------------------+--------------------------+-----------+----------+-------------------------------------------------+
    | resource_description | text                     |           | not null |                                                 |
    +----------------------+--------------------------+-----------+----------+-------------------------------------------------+
    | date_added           | timestamp with time zone |           | not null |                                                 |
    +----------------------+--------------------------+-----------+----------+-------------------------------------------------+
    | resource             | character varying(100)   |           | not null |                                                 |
    +----------------------+--------------------------+-----------+----------+-------------------------------------------------+
    | station_id           | integer                  |           |          |                                                 |
    +----------------------+--------------------------+-----------+----------+-------------------------------------------------+
    Indexes:
     "stationmeta_aux_doc_pkey" PRIMARY KEY, btree (id)
     "stationmeta_aux_doc_station_id_17bdb5f2" btree (station_id)
    Foreign-key constraints:
     "stationmeta_aux_doc_station_id_17bdb5f2_fk_stationmeta_core_id" FOREIGN KEY (station_id) REFERENCES stationmeta_core(id) DEFERRABLE INITIALLY DEFERRED
    """

    __tablename__ = 'stationmeta_aux_doc'

    id = Column(Integer, STATIONMETA_AUX_DOC_ID_SEQ, primary_key=True, server_default=STATIONMETA_AUX_DOC_ID_SEQ.next_value())
    resource_description = Column(Text, nullable=False)
    date_added = Column(DateTime(True), nullable=False)
    resource = Column(String(100), nullable=False)
    station_id = Column(ForeignKey(StationmetaCore.id, deferrable=True, initially='DEFERRED'), index=True)

    station = relationship('StationmetaCore')


STATIONMETA_AUX_IMAGE_ID_SEQ = Sequence('stationmeta_aux_image_id_seq') #define sequence explicitly
class StationmetaAuxImage(Base):
    """ Table "public.stationmeta_aux_image"

    +----------------------+--------------------------+-----------+----------+---------------------------------------------------+
    |        Column        |           Type           | Collation | Nullable |                      Default                      |
    +======================+==========================+===========+==========+===================================================+
    | id                   | integer                  |           | not null | nextval('stationmeta_aux_image_id_seq'::regclass) |
    +----------------------+--------------------------+-----------+----------+---------------------------------------------------+
    | resource_description | text                     |           | not null |                                                   |
    +----------------------+--------------------------+-----------+----------+---------------------------------------------------+
    | date_added           | timestamp with time zone |           | not null |                                                   |
    +----------------------+--------------------------+-----------+----------+---------------------------------------------------+
    | resource             | character varying(100)   |           | not null |                                                   |
    +----------------------+--------------------------+-----------+----------+---------------------------------------------------+
    | image_height         | integer                  |           | not null |                                                   |
    +----------------------+--------------------------+-----------+----------+---------------------------------------------------+
    | image_width          | integer                  |           | not null |                                                   |
    +----------------------+--------------------------+-----------+----------+---------------------------------------------------+
    | station_id           | integer                  |           |          |                                                   |
    +----------------------+--------------------------+-----------+----------+---------------------------------------------------+
    Indexes:
     "stationmeta_aux_image_pkey" PRIMARY KEY, btree (id)
     "stationmeta_aux_image_station_id_fbfbdb29" btree (station_id)
    Check constraints:
     "stationmeta_aux_image_image_height_check" CHECK (image_height >= 0)
     "stationmeta_aux_image_image_width_check" CHECK (image_width >= 0)
     Foreign-key constraints:
     "stationmeta_aux_imag_station_id_fbfbdb29_fk_stationme" FOREIGN KEY (station_id) REFERENCES stationmeta_core(id) DEFERRABLE INITIALLY DEFERRED
    """

    __tablename__ = 'stationmeta_aux_image'
    __table_args__ = (
        CheckConstraint('image_height >= 0'),
        CheckConstraint('image_width >= 0')
    )

    id = Column(Integer, STATIONMETA_AUX_IMAGE_ID_SEQ, primary_key=True, server_default=STATIONMETA_AUX_IMAGE_ID_SEQ.next_value())
    resource_description = Column(Text, nullable=False)
    date_added = Column(DateTime(True), nullable=False)
    resource = Column(String(100), nullable=False)
    image_height = Column(Integer, nullable=False)
    image_width = Column(Integer, nullable=False)
    station_id = Column(ForeignKey(StationmetaCore.id, deferrable=True, initially='DEFERRED'), index=True)
    
    station = relationship('StationmetaCore')


STATIONMETA_AUX_URL_ID_SEQ = Sequence('stationmeta_aux_url_id_seq') #define sequence explicitly
class StationmetaAuxUrl(Base):
    """ Table "public.stationmeta_aux_url"

    +----------------------+--------------------------+-----------+----------+-------------------------------------------------+
    |        Column        |           Type           | Collation | Nullable |                     Default                     |
    +======================+==========================+===========+==========+=================================================+
    | id                   | integer                  |           | not null | nextval('stationmeta_aux_url_id_seq'::regclass) |
    +----------------------+--------------------------+-----------+----------+-------------------------------------------------+
    | resource_description | text                     |           | not null |                                                 |
    +----------------------+--------------------------+-----------+----------+-------------------------------------------------+
    | date_added           | timestamp with time zone |           | not null |                                                 |
    +----------------------+--------------------------+-----------+----------+-------------------------------------------------+
    | resource             | character varying(200)   |           | not null |                                                 |
    +----------------------+--------------------------+-----------+----------+-------------------------------------------------+
    | station_id           | integer                  |           |          |                                                 |
    +----------------------+--------------------------+-----------+----------+-------------------------------------------------+
    Indexes:
     "stationmeta_aux_url_pkey" PRIMARY KEY, btree (id)
     "stationmeta_aux_url_station_id_727571bd" btree (station_id)
    Foreign-key constraints:
      "stationmeta_aux_url_station_id_727571bd_fk_stationmeta_core_id" FOREIGN KEY (station_id) REFERENCES stationmeta_core(id) DEFERRABLE INITIALLY DEFERRED
    """

    __tablename__ = 'stationmeta_aux_url'

    id = Column(Integer, STATIONMETA_AUX_URL_ID_SEQ, primary_key=True, server_default=STATIONMETA_AUX_URL_ID_SEQ.next_value())
    resource_description = Column(Text, nullable=False)
    date_added = Column(DateTime(True), nullable=False)
    resource = Column(String(200), nullable=False)
    station_id = Column(ForeignKey(StationmetaCore.id, deferrable=True, initially='DEFERRED'), index=True)

    station = relationship('StationmetaCore')