
    j'                    V   d Z ddlmZ ddlmZmZ ddlmZ  ede      Z	 edd       G d d	             Z
 edd       G d
 d             Z edd       G d d             Z edd       G d d             Z edd       G d d             Z edd       G d d             Zy)zCTyped, privacy-minimized values emitted by the historical importer.    )annotations)asdict	dataclass)NewTypeCanonicalDayT)frozenslotsc                  0    e Zd ZU dZded<   ded<   ded<   y)SourceRecordzGOne immutable source explicitly authorized by the raw-history manifest.strsource_pathsha256range_labelN)__name__
__module____qualname____doc____annotations__     k/home/cube/projects/richard/.worktrees/nutricoach-v140-impl/dualcoach/profile/checkin_cli/history_models.pyr   r      s    QKr   r   c                      e Zd ZU dZded<   ded<   ded<   ded<   ded<   d	ed
<   d	ed<   ded<   ded<   ded<   ded<   ddZy)BaselineEntryzGOne date-keyed, structured historical measurement without source prose.r   dayr   recorded_dater   source_sha256section_anchorzfloat | None	weight_kgsleep_hoursz
int | Nonecalories_kcaltuple[str, ...]training_tokensz
str | Nonedigestion_statuspain_tokensc                    t        |       S )zGProduce the exact structured values permitted in profile-local storage.r   selfs    r   to_storage_dictzBaselineEntry.to_storage_dict%       d|r   N)returnz5dict[str, str | int | float | None | tuple[str, ...]]r   r   r   r   r   r)   r   r   r   r   r      sL    Q	$$    r   r   c                  8    e Zd ZU dZded<   ded<   ded<   d	dZy)
DuplicateDayzKAuditable repeated day anchors, without retaining their narrative headings.r   r   r!   source_anchorsconflicting_fieldsc                    t        |       S )zGSerialize only canonical anchors and field names, never source content.r&   r'   s    r   r)   zDuplicateDay.to_storage_dict2   r*   r   N)r+   z dict[str, int | tuple[str, ...]]r,   r   r   r   r.   r.   *   s    U	##''r   r.   c                  $    e Zd ZU dZded<   ddZy)ReconciliationzCOverlap and conflict details required to audit canonical selection.ztuple[DuplicateDay, ...]duplicate_daysc                >    dt        d | j                  D              iS )z4Serialize reconciliation evidence without free text.r4   c              3  <   K   | ]  }|j                           y wNr)   .0items     r   	<genexpr>z1Reconciliation.to_storage_dict.<locals>.<genexpr>?   s     '_K^4(<(<(>K^   )tupler4   r'   s    r   r)   zReconciliation.to_storage_dict=   s     %'_4K^K^'_"_``r   N)r+   z7dict[str, tuple[dict[str, int | tuple[str, ...]], ...]]r,   r   r   r   r3   r3   7   s    M,,ar   r3   c                  V    e Zd ZU dZded<   ded<   ded<   ded<   ded<   ded	<   dd
Zy)Coveragez3Observed daily-record coverage and per-metric gaps.r   first_observed_daylast_observed_dayztuple[CanonicalDay, ...]missing_daysdays_without_measurementsdays_with_weightdays_with_sleepc                    t        |       S )z0Serialize coverage as canonical day tokens only.r&   r'   s    r   r)   zCoverage.to_storage_dictM   r*   r   N)r+   z dict[str, int | tuple[int, ...]]r,   r   r   r   r@   r@   B   s.    =$$##**77..--r   r@   c                  8    e Zd ZU dZded<   ded<   ded<   d
dZy	)BaselinezHFull parser result before it is committed as append-only profile events.ztuple[BaselineEntry, ...]entriesr@   coverager3   reconciliationc                    dt        d | j                  D              | j                  j                         | j                  j                         dS )z;Return a reproducible, prose-free baseline storage payload.z1.0c              3  <   K   | ]  }|j                           y wr7   r8   r9   s     r   r<   z+Baseline.to_storage_dict.<locals>.<genexpr>^   s     MT113r=   )storage_versionrJ   rK   rL   )r>   rJ   rK   r)   rL   r'   s    r   r)   zBaseline.to_storage_dictZ   sE      %MMM557"11AAC	
 	
r   N)r+   zdict[str, object]r,   r   r   r   rI   rI   R   s    R&&""
r   rI   N)r   
__future__r   dataclassesr   r   typingr   intr   r   r   r.   r3   r@   rI   r   r   r   <module>rT      s    I " )  ~s+ $d#  $ $d#  $( $d#	 	 $	 $d#a a $a $d#  $ $d#
 
 $
r   