
    4Ei                         d dl mZ ej                  Z G d dej                        Z G d dej                        Z G d dej                        Zy)	    )modelsc                      e Zd ZdZ ej
                  d      Z ej                  dd      Z ej                  dd      Z
 ej                  d      Z ej                  d      Z ej                  d	      Z G d
 d      Zd Zy)CheckInTemplatezr
    Reusable named template that defines which fields are available for online
    check-in for a structure.
       
max_lengthT)r   unique)blanknulldefaultauto_now_add)auto_nowc                       e Zd ZdZdgZy)CheckInTemplate.Metacheckin_templatesnameN__name__
__module____qualname__db_tableordering     /backend/checkin/models.pyMetar      s    &8r   r   c                     | j                   S )N)r   selfs    r   __str__zCheckInTemplate.__str__   s    yyr   N)r   r   r   __doc__r   	CharFieldr   	SlugFieldslug	TextFielddescriptionBooleanField	is_activeDateTimeField
created_at
updated_atr   r"   r   r   r   r   r      s     6s+D6s48D"&""D9K###D1I%%%48J%%%t4J r   r   c                   l   e Zd ZdZdZdZdZedfedfedfgZdZd	Z	d
Z
dZdZdZdZdZdZdZedfe	dfe
dfedfedfedfedfedfedfedfg
Z ej(                  eej,                  d      Z ej0                  dd       Z ej4                  d!      Z ej4                  d"d#d#$      Z ej4                  d%ee&      Z ej4                  d'ee&      Z ej>                  d#(      Z  ej>                  d)(      Z! e"d#d#e#*      Z$ ejJ                  d+(      Z& ejN                  d#,      Z( G d- d.      Z)d/ Z*y0)1CheckInTemplateFielda  
    A single field definition inside a CheckInTemplate.

    - field_type: determines frontend input type (text, email, date, select, file, etc.)
    - target: whether the field applies to main guest, additional guest, or both
    - meta: JSON blob for extra options (select options, placeholder, validation, etc.)
    - is_enabled/is_required control rendering and validation
    - order controls UI ordering
    main
additionalbothz
Main guestzAdditional guestBothtexttextareaselectradiocheckboxdateemailphonefilenumberTextz	Text areaSelectRadioCheckboxDateEmailPhoneFileNumberfields	on_deleterelated_namer   z,Unique per template (used as key in payload))r   	help_textr   i   T)r   r
   r       )r   choicesr      r   F)r
   r   r   d   r   c                       e Zd ZdZddgZy)CheckInTemplateField.Metacheckin_template_fieldsorderidNr   r   r   r   r   rQ   V   s    ,T?r   r   c                 L    | j                   j                   d| j                   S )Nu    — )templater   labelr    s    r   r"   zCheckInTemplateField.__str__[   s"    --$$%U4::,77r   N)+r   r   r   r#   TARGET_MAINTARGET_ADDITIONALTARGET_BOTHTARGET_CHOICES
FIELD_TEXTFIELD_TEXTAREAFIELD_SELECTFIELD_RADIOFIELD_CHECKBOX
FIELD_DATEFIELD_EMAILFIELD_PHONE
FIELD_FILEFIELD_NUMBERFIELD_TYPE_CHOICESr   
ForeignKeyr   CASCADErV   r%   r&   r$   rW   rK   
field_typetargetr)   
is_enabledis_requiredJSONdictmetaPositiveIntegerFieldrS   r+   r,   r   r"   r   r   r   r/   r/      s    K$K 
l#	./	fN JNLKNJKKJL 
V	%	x 	g	$	V	g	g	V	x  !v  ..H
 6s6deDF,E   Ct$GI!!!R9KU_`JV^[YF$$$T2J%&%%e4Kdt4D'F''4E%%%48J# #
8r   r/   c                       e Zd ZdZ ej
                  dej                  d      Z ej
                  eej                  d      Z
 ej                  d      Z ej                  d      Z G d	 d
      Zd Zy)StructureCheckInTemplatez
    Assignment of a CheckInTemplate to a Structure (accommodation).
    Multiple templates can exist; this model marks which template(s) a structure uses.
    Typically a structure will have one active template (is_active=True).
    zstructures.Structurer   rH   structure_linksTr   r   c                       e Zd ZdZdZddgZy)StructureCheckInTemplate.Metastructure_checkin_templates	structurerV   z
-is_activeassigned_atN)r   r   r   r   unique_togetherr   r   r   r   r   ru   s   s    03 -0r   r   c                 8    | j                    d| j                   S )Nz -> rw   r    s    r   r"   z StructureCheckInTemplate.__str__x   s    ..!dmm_55r   N)r   r   r   r#   r   rg   rh   rx   r   PROTECTrV   r)   r*   r+   ry   r   r"   r   r   r   rr   rr   _   s~     "!!..(I
 !v  ..&H
 $##D1I&&&&D9K1 1
6r   rr   N)	django.dbr   	JSONFieldrm   Modelr   r/   rr   r   r   r   <module>r      sF    fll (C86<< C8L6v|| 6r   