
    h6                     j    d dl m Z mZ d dlmZmZmZmZmZmZm	Z	m
Z
 d dlmZ d dlmZ  G d de      Zy)    )datetimetimezone)ColumnDateTime
ForeignKeyIntegerStringUniqueConstraintIndexCheckConstraint)relationship)Basec                      e Zd ZdZdZ eed      Z e ed      d      Z	 ee e
dd	
      dd      Z ee e
dd	
      dd      Z ee e
dd	
      dd      Z ee e
dd	
      dd      Z ee e
dd	
      dd      Z ee ej$                  ej(                        d      Z ee ej$                  ej(                         ej$                  ej(                        d      Z edd      Z edd      Z edd      Z edd      Z edd      Z edd       eddd       eddd        edd!d"       edd#d$       edd%d&       ed'd       ed(ddd!d#d%      fZ y))*WineAppellationa  
    Tree index/lookup for the wine geography hierarchy.

    Exactly ONE of the level FKs below must be non-null, representing what this
    row points to:
        - country_id
        - region_id
        - sub_region_id
        - appellation_id
        - sub_appellation_id
    wine_appellationsT)primary_key   F)nullablezcountries.idRESTRICT)ondelete)r   indexz
regions.idzsub_regions.idzappellations.idzsub_appellations.id)defaultr   )r   onupdater   Countryjoined)lazyRegion	SubRegionAppellationSubAppellationz(country_id IS NOT NULL)::int + (region_id IS NOT NULL)::int + (sub_region_id IS NOT NULL)::int + (appellation_id IS NOT NULL)::int + (sub_appellation_id IS NOT NULL)::int = 1&ck_wine_appellations_exactly_one_level)nametitle
country_iduq_wa_title_country	region_iduq_wa_title_regionsub_region_iduq_wa_title_sub_regionappellation_iduq_wa_title_appellationsub_appellation_iduq_wa_title_sub_appellationix_wine_appellations_title!ix_wine_appellations_level_pickerN)!__name__
__module____qualname____doc____tablename__r   r   idr	   r#   r   r$   r&   r(   r*   r,   r   r   nowr   utc
created_at
updated_atr   countryregion
sub_regionappellationsub_appellationr   r
   r   __table_args__     d/var/www/html/wine-match-dev/backend/winematch-backend/src/apps/wine_settings/models/appellations.pyr   r      s   
 (M	T	*B6#;/ENZ!P[_gklJw
<* MX\dhiI7J/?*$U`dlpqMGZ0AJ%WbfnrsN4IT^)_jnvz{,(,,x||*DuUJ,(,,x||*D|x||\d\h\hOityzJ984G(2Fk9J}8<K"#3(CO 	8
 :	
 	,5JK+4HI/8PQ"29RS"6=Z[*G41K:JL`	b#NrA   r   N)r   r   
sqlalchemyr   r   r   r   r	   r
   r   r   sqlalchemy.ormr   src.core.models.baser   r   r@   rA   rB   <module>rF      s+    '	 	 	 ( %3d 3rA   