o
    h	                     @   sR   d dl mZ d dlmZ G dd dejZG dd dejZG dd dejZd	S )
    )models)Customerc                   @   sr   e Zd Zg dZejddZejdedZe Z	ejdddZ
ejd	ddZejdd
ZejddZdd ZdS )NetworkDevice))routerRouter)switchSwitch)access_pointzAccess Point)serverServerd   
max_length   )r   choices   Tr   blank   defaultauto_now_addc                 C   s   | j  d| j dS )Nz ())name
ip_addressself r   ./var/www/html/optinet_system/network/models.py__str__      zNetworkDevice.__str__N)__name__
__module____qualname__DEVICE_TYPE_CHOICESr   	CharFieldr   device_typeGenericIPAddressFieldr   mac_addresslocationBooleanField	is_activeDateTimeField
created_atr    r   r   r   r   r      s    r   c                   @   s   e Zd ZejeejddZejddZ	ejddZ
ejdddZejdddZejdd	Zejd
d	ZejdddZejdd	Zejdd	ZejdddZejddZejddZdd Zedd ZdS )ClientConnectionconnections	on_deleterelated_namer   r   T)nullr   r   r   r   Fr   r   )auto_nowc                 C   s   | j j d| j S )N - )customer	full_nameusernamer   r   r   r   r    ,   r!   zClientConnection.__str__c                 C   s   | j | j }t|d dS )Ni   @   )bytes_uploadedbytes_downloadedround)r   total_bytesr   r   r   total_usage_gb/   s   zClientConnection.total_usage_gbN)r"   r#   r$   r   
ForeignKeyr   CASCADEr7   r&   r9   passwordr(   r   r)   r+   r,   	is_onliner-   	last_seenBigIntegerFieldr;   r<   DurationFieldsession_timer.   
updated_atr    propertyr?   r   r   r   r   r/      s"    r/   c                   @   sX   e Zd ZejeejddZejddZ	ej
ddZejddZdd	 ZG d
d dZdS )ConnectionLoglogsr1   2   r   Tr   )r   c                 C   s   | j j d| j d| j S )Nr6   z at )
connectionr9   action	timestampr   r   r   r   r    :   s   zConnectionLog.__str__c                   @   s   e Zd ZdgZdS )zConnectionLog.Metaz
-timestampN)r"   r#   r$   orderingr   r   r   r   Meta=   s    
rQ   N)r"   r#   r$   r   r@   r/   rA   rM   r&   rN   r-   rO   	TextFielddetailsr    rQ   r   r   r   r   rJ   4   s    rJ   N)	django.dbr   customers.modelsr   Modelr   r/   rJ   r   r   r   r   <module>   s
   