
    j                    z    d Z ddlmZ ddlZddlmZ ddlmZ ddlm	Z	 dd
Z
ddZddZd dZd!dZd"dZd#dZdS )$z4Script draft and Telegram review formatting helpers.    )annotationsN)Path)Any)score_idea_retentionvaluestrreturnc                    t          j        dd|                                                               d          }|pdS )Nz[^a-zA-Z0-9]+-draft)resublowerstrip)r   slugs     R/home/agent/jarvis_runtime/autoshortsbot/AutoShortsBot/autoshorts/script_drafts.py_slugr      s6    6"C77==cBBD?7    pillar	list[str]c                J    g dg dg dd}|                     | ddg          S )N)z#focusz#selfimprovement#lifesystemsz#mindset)z#aiz#productivityz#promptsr   )z	#faithtokz
#christianz#prayerz#discipline)life_optimizationai_life_systemsfaithtokz#shortsz#growth)get)r   defaultss     r   _hashtags_for_pillarr      sD    WWWOOOIII H
 <<I 6777r   duration_secondsintlist[tuple[str, int]]c                :   t          dt          d| dz                      }t          dt          d| dz                      }t          dt          | dz                      }t          d| |z
  |z
  |z
            }||z   |z   |z   }|| |z
  z  }d|fd	|fd
|fd|fgS )zGAllocate simple timed sections that sum exactly to the target duration.      
         gQ?   HookSetup
Core ValueCTA)minmaxr    )r   hookctasetupr   totals         r   _allocate_sectionsr3      s    q#a)R/0011D
aQ(B.//
0
0C3'$.//00E#d*S05899E5L5 3&E	%%ETNWe,|U.CeS\RRr   ideadict[str, Any]c                   t          | d                   }t          |          }| d                                         }| d                                         }| d                                         }d|d         d         |dd	|d         d         t          |           dd
|d         d         |dd|d         d         |dg}t	          |           }i d| d         d| d         d| d         d|d| d         d|dk    rdndd|d|d| d         d| d         d|dt          | d                   dt          | d                   d|d         d|d         d|d          d!|                     d!d"          S )#zGBuild a deterministic first script draft from a curated testbatch idea.r   script_outliner/   r0   r)   r      )labelsecondstextr*   r+   r$   r,   r#   idr   titleplatform_targetplatform_note<   zTikTok Rewards CandidatezGrowth Shortsectionsvisual_conceptcaptionhashtagsquality_scoreretention_scorescoreretention_signalssignalsretention_risksrisks
risk_notes )r    r3   r   _setup_liner   r   r   )r4   durationallocationsoutliner/   r0   rA   	retentions           r   build_script_draftrS   %   s   4*+,,H$X..K#$**,,G<D
u+



C [^A%6EE"1~a(%%	
 	
 ""1~a(	
 	

 KN1$5sCCH %T**Id4j$x. 	g 	H	
 	4 12 	x2~~33> 	 	H 	$/0 	4	? 	s 	(h88 	T/233 	9W- 	Yy1  	9W-!" 	dhh|R00# r   c                F    | d         }|dk    rdS |dk    rdS |dk    rdS dS )	Nr   r   z]A quiet, honest moment for people who feel spiritually tired but still want to return to God.r   zTThe point is not hype. The point is a simple system where the human stays in charge.attention_designzlThis is not a willpower lecture. It is attention design: change the default before the feed chooses for you.z\This is not another motivation trick. It is a small environmental system you can test today. )r4   r   s     r   rN   rN   S   sF    (^Fnn"""ee###}}iir   r   c                z   d                     | d                   }d                     | d                   }d                     d | d         D                       }d                     g d	| d
          d| d          d| d          d| d          d| d          d| d| d          d| d          dd                     | d                   pd dd                     | d                   pd d| d          d| d | d!          d"| d#          d$| d%| d&         pd' d(          S ))z,Format a draft for Telegram approval review.z, r>    rD   
c              3  P   K   | ]!}d |d          d|d          d|d          V  "dS )z- **r9   z** (r:   zs): r;   NrV   ).0sections     r   	<genexpr>z)format_telegram_review.<locals>.<genexpr>b   s]         	OwwNNWY%7NNWV_NN     r   rA   rM   z"## AutoShortsBot Review

**ID:** `r<   z`
**Pillar:** `r   z`
**Title:** r=   z
**Duration:** r   u   s — r?   z
**Platforms:** z
**Quality Score:** rE   z/10
**Retention Score:** rF   z/10
**Retention Signals:** rH   nonez
**Retention Risks:** rJ   z

**Hook:** r/   z

**Script Draft:**
z

**Visual Concept:** rB   z

**Caption:** rC   z
**Hashtags:** z

**Policy/Risk Notes:** rL   zKeine besonderen Risiken.u   

**Approval commands:**
- `Freigabe alle`
- `Freigabe YouTube`
- `Freigabe TikTok`
- `Freigabe Instagram`
- `Ablehnen`
- `Ändern: <Wunsch>`
)join)r   	platformsrD   rA   s       r   format_telegram_reviewra   ^   s   		% 1233Ixxj)**Hyy  Z(    H     
+    Ho    'N	   
 '(   
 16o0F        /*    -.    		%(;"<==G    ii&7 899CV    =    
   " +,#   & I'   ( )   , l+J/J-      r   batch
output_dirr   
list[Path]c                B   |                     dd           g }|                     dg           D ]n}t          |          }||d          dt          |d                    dz  }|                    t          |          d	           |                    |           o|S )
z7Write one Telegram-ready Markdown review file per idea.T)parentsexist_okideasr<   r   r=   z.mdzutf-8)encoding)mkdirr   rS   r   
write_textra   append)rb   rc   writtenr4   r   paths         r   write_review_draftsro      s    TD111G		'2&&  "4((uT{GGU5>-B-BGGGG.u55HHHtNr   )r   r   r	   r   )r   r   r	   r   )r   r    r	   r!   )r4   r5   r	   r5   )r4   r5   r	   r   )r   r5   r	   r   )rb   r5   rc   r   r	   rd   )__doc__
__future__r   r   pathlibr   typingr   autoshorts.retentionr   r   r   r3   rS   rN   ra   ro   rV   r   r   <module>ru      s    : : " " " " " " 				             5 5 5 5 5 5   
8 8 8 8S S S S+ + + +\j j j j' ' ' 'T	 	 	 	 	 	r   