a
    Si                  
   @   s   d dl mZ d dlmZmZmZmZ d dlmZ ddl	m
Z
 d dlmZ G dd dZed	e
jed
edddededddZe
ee dS )    )g)ColumnIntegerTableString)Geometry   )schema)UniqueConstraintc                   @   sD   e Zd Zdd Zedd Zedd Zedd Zed	d
 ZdS )CustomGroupc                 C   s
   || _ d S )Nname)selfr    r   l/var/www/staging/api/virtual_environments/venv/lib/python3.9/site-packages/main/models/insar/custom_group.py__init__   s    zCustomGroup.__init__c                 C   s   | j s
dS dS )NzName must existTr   r   r   r   r   	validates   s    zCustomGroup.validatesc                 C   s   | j | jdS )Nidr   r   r   r   r   r   base_output   s    zCustomGroup.base_outputc                 C   s&   | j }t| j|d< t| j|d< |S )Ncustom_pointscustom_polygons)r   lenr   r   r   outputr   r   r   r      s    zCustomGroup.outputc                 C   s2   | j }dd | jD |d< dd | jD |d< |S )Nc                 S   s   g | ]}|j d dqS )T)Zinclude_timeline_data)r   .0cpr   r   r   
<listcomp>#       z9CustomGroup.output_with_custom_points.<locals>.<listcomp>r   c                 S   s   g | ]
}|j qS r   )Zto_dict_minimalr   r   r   r   r   $   r    r   )r   r   r   r   r   r   r   output_with_custom_points    s    z%CustomGroup.output_with_custom_pointsN)	__name__
__module____qualname__r   propertyr   r   r   r!   r   r   r   r   r      s   


r   Zcustom_groupsr   T)Zprimary_keyZautoincrementr   F)ZnullableuniqueN)Zflaskr   Z
sqlalchemyr   r   r   r   Zgeoalchemy2r   Z_mapperr	   r
   r   metadataZcustom_groups_tableZmap_imperativelyr   r   r   r   <module>   s    