# coding: utf-8
"""
class StationmetaGlobalService (Base)
=====================================
"""
from sqlalchemy import CheckConstraint, Column, Integer, String, Sequence
from toardb.base import Base    

STATIONMETA_GLOBAL_SERVICES_ID_SEQ = Sequence('stationmeta_global_services_id_seq')  # define sequence explicitly
class StationmetaGlobalService(Base):
    """ Table "public.stationmeta_global_services"

    +--------------------+------------------------+-----------+----------+---------------------------------------------------------+
    |       Column       |          Type          | Collation | Nullable |                         Default                         |
    +====================+========================+===========+==========+=========================================================+
    | id                 | integer                |           | not null | nextval('stationmeta_global_services_id_seq'::regclass) |
    +--------------------+------------------------+-----------+----------+---------------------------------------------------------+
    | variable_name      | character varying(64)  |           | not null |                                                         |
    +--------------------+------------------------+-----------+----------+---------------------------------------------------------+
    | result_type        | integer                |           | not null |                                                         |
    +--------------------+------------------------+-----------+----------+---------------------------------------------------------+
    | result_nvalues     | integer                |           | not null |                                                         |
    +--------------------+------------------------+-----------+----------+---------------------------------------------------------+
    | service_valid_year | integer                |           |          |                                                         |
    +--------------------+------------------------+-----------+----------+---------------------------------------------------------+
    | service_url        | character varying(200) |           | not null |                                                         |
    +--------------------+------------------------+-----------+----------+---------------------------------------------------------+
    Indexes:
     "stationmeta_global_services_pkey" PRIMARY KEY, btree (id)
     "stationmeta_global_services_service_url_key" UNIQUE CONSTRAINT, btree (service_url)
     "stationmeta_global_services_service_url_c8ee80c5_like" btree (service_url varchar_pattern_ops)
    Check constraints:
     "stationmeta_global_services_result_nvalues_check" CHECK (result_nvalues >= 0)
     "stationmeta_global_services_result_type_check" CHECK (result_type >= 0)
     "stationmeta_global_services_service_valid_year_check" CHECK (service_valid_year >= 0)
    """

    __tablename__ = 'stationmeta_global_services'
    __table_args__ = (
        CheckConstraint('result_nvalues >= 0'),
        CheckConstraint('result_type >= 0'),
        CheckConstraint('service_valid_year >= 0')
    )

    id = Column(Integer, STATIONMETA_GLOBAL_SERVICES_ID_SEQ, primary_key=True, server_default=STATIONMETA_GLOBAL_SERVICES_ID_SEQ.next_value())
    variable_name = Column(String(64), nullable=False)
    result_type = Column(Integer, nullable=False)
    result_nvalues = Column(Integer, nullable=False)
    service_valid_year = Column(Integer)
    service_url = Column(String(200), nullable=False, unique=True)