o
    i3%                  	   @  sN  d dl mZ d dlmZ d dlmZmZ G dd dZG dd dZG dd	 d	Z	G d
d dZ
G dd dZG dd deeZd.d/ddZejg dejg dejg dejg diZG dd deeZg dZg dZG dd  d eZG d!d" d"eZG d#d$ d$eZG d%d& d&eZG d'd( d(eZG d)d* d*eZG d+d, d,eZd-S )0    )annotations)Enum)	BaseModelFieldc                   @  s   e Zd Zd
ddZdd Zd	S )RecraftColorrintgbc                 C  s   |||g| _ d S N)color)selfr   r	   r
    r   :/mnt/c/Users/fbmor/ComfyUI/comfy_api_nodes/apis/recraft.py__init__	      zRecraftColor.__init__c                 C  s   t | jdS )N)rgb)RecraftColorObjectr   r   r   r   r   create_api_model   s   zRecraftColor.create_api_modelN)r   r   r	   r   r
   r   __name__
__module____qualname__r   r   r   r   r   r   r      s    
r   c                   @  s@   e Zd Zdd Zdd ZdddZd	d
 Zdd ZdddZdS )RecraftColorChainc                 C  s
   g | _ d S r   colorsr   r   r   r   r      s   
zRecraftColorChain.__init__c                 C  s   t | jdkr| jd S d S )Nr   )lenr   r   r   r   r   	get_first   s   
zRecraftColorChain.get_firstr   r   c                 C  s   | j | d S r   )r   append)r   r   r   r   r   add   r   zRecraftColorChain.addc                 C  s   | j sd S dd | j D }|S )Nc                 S  s   g | ]}|  qS r   )r   ).0xr   r   r   
<listcomp>   s    z6RecraftColorChain.create_api_model.<locals>.<listcomp>r   )r   
colors_apir   r   r   r      s   z"RecraftColorChain.create_api_modelc                 C  s    t  }| jD ]}|| q|S r   )r   r   r    )r   cr   r   r   r   clone"   s   
zRecraftColorChain.cloneotherc                 C  s"   |   }|jD ]}|| q|S r   )r&   r   r    )r   r'   r%   r   r   r   r   clone_and_merge(   s   
z!RecraftColorChain.clone_and_mergeN)r   r   )r'   r   )	r   r   r   r   r   r    r   r&   r(   r   r   r   r   r      s    
r   c                   @  s$   e Zd Z		ddd	d
Zdd ZdS )RecraftControlsNr   r   background_colorartistic_levelr   no_textboolc                 C  s   || _ || _|| _|| _d S r   r   r*   r+   r,   )r   r   r*   r+   r,   r   r   r   r   0   s   
zRecraftControls.__init__c                 C  sx   | j d u r| jd u r| jd u r| jd u rd S d }d }| j r"| j  }| jr2| j }|r0| nd }t||| j| jdS )Nr.   )r   r*   r+   r,   r   r   RecraftControlsObject)r   r$   background_color_apifirst_backgroundr   r   r   r   7   s   (

z RecraftControls.create_api_model)NNNN)r   r   r*   r   r+   r   r,   r-   r   r   r   r   r   r)   /   s
    r)   c                   @  s   e Zd Zdd	ddZdS )
RecraftStyleNstylestrsubstylestyle_idc                 C  s"   || _ |dkr	d }|| _|| _d S NNone)r3   r5   r6   )r   r3   r5   r6   r   r   r   r   G   s
   
zRecraftStyle.__init__)NNN)r3   r4   r5   r4   r6   r4   )r   r   r   r   r   r   r   r   r2   F   s    r2   c                   @  s   e Zd ZdZdZdZdS )	RecraftIORECRAFT_V3_STYLERECRAFT_COLORRECRAFT_CONTROLSN)r   r   r   STYLEV3COLORCONTROLSr   r   r   r   r9   O   s    r9   c                   @  s   e Zd ZdZdZdZdZdS )RecraftStyleV3realistic_imagedigital_illustrationvector_illustrationlogo_rasterN)r   r   r   rA   rB   rC   rD   r   r   r   r   r@   U   s
    r@   Tstyle_v3r4   return	list[str]c                 C  s"   g }|r	| d |t| g  S r7   )r   dict_recraft_substyles_v3get)rE   include_none	substylesr   r   r   get_v3_substyles]   s   
rL   )b_and_w
enterpriseevening_lightfaded_nostalgiaforest_life
hard_flashhdrmotion_blurmystic_naturalismnatural_lightnatural_tonesorganic_calmreal_life_glowretro_realismretro_snapshotstudio_portraiturban_dramavillage_realism	warm_folk))2d_art_poster2d_art_poster_2antiquarianbold_fantasy
child_bookchild_bookscover
crosshatchdigital_engravingengraving_colorexpressionismfreehand_detailsgraingrain_20graphic_intensity
hand_drawnhand_drawn_outlinehandmade_3dhard_comicsinfantile_sketchlong_shadowmodern_folk
multicolor	neon_calmnoirnostalgic_pasteloutline_detailspastel_gradientpastel_sketch	pixel_artplasticpop_artpop_renaissanceseamless
street_arttablet_sketch
urban_glowurban_sketchingvanilla_dreamsyoung_adult_bookyoung_adult_book_2)bold_stroke	chemistrycolored_stencilcontour_pop_artcosmicscutout
depressive	editorialemotional_flat	engravinginfographicalline_artline_circuitlinocutmarker_outlinemosaic	naivectorroundish_flatr   segmented_colorssharp_contrastthinvector_photovivid_shapes)emblem_graffitiemblem_pop_artemblem_punkemblem_stampemblem_vintagec                   @  sH   e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZdZdZdZdZdS )RecraftImageSize	1024x1024	1365x1024	1024x1365	1536x1024	1024x1536	1820x1024	1024x1820	1024x2048	2048x1024	1434x1024	1024x1434	1024x1280	1280x1024	1024x1707	1707x1024N)r   r   r   res_1024x1024res_1365x1024res_1024x1365res_1536x1024res_1024x1536res_1820x1024res_1024x1820res_1024x2048res_2048x1024res_1434x1024res_1024x1434res_1024x1280res_1280x1024res_1024x1707res_1707x1024r   r   r   r   r      s     r   )r   1536x768768x15361280x832832x12801216x896896x12161152x896896x1152832x13441280x896896x12801344x768768x1344)	2048x2048	3072x1536	1536x3072	2560x1664	1664x2560	2432x1792	1792x2432	2304x1792	1792x2304	1664x2688r   r   	2560x1792	1792x2560c                   @  "   e Zd ZU edddZded< dS )r   .zIAn array of 3 integer values in range of 0...255 defining RGB Color Modeldescriptionz	list[int]r   N)r   r   r   r   r   __annotations__r   r   r   r   r         
 r   c                   @  s^   e Zd ZU edddZded< edddZded< edd	dZd
ed< edddZded< dS )r/   NzAn array of preferable colorsr   zlist[RecraftColorObject] | Noner   z-Use given color as a desired background colorzRecraftColorObject | Noner*   zDo not embed text layoutszbool | Noner,   zDefines artistic tone of your image. At a simple level, the person looks straight at the camera in a static and clean style. Dynamic and eccentric levels introduce movement and creativity. The value should be in range [0..5].
int | Noner+   )	r   r   r   r   r   r   r*   r,   r+   r   r   r   r   r/     
   
 r/   c                   @  s   e Zd ZU edddZded< edddZded	< edd
dZded< edddZded< edZ	ded< edddZ
ded< edddZded< edddZded< edddZded< edddZded< edddZded< dS )RecraftImageGenerationRequest.z0The text prompt describing the image to generater   r4   promptNz3The size of the generated image (e.g., "1024x1024")z
str | Nonesizez The number of images to generater   nz4A text description of undesired elements on an imagenegative_promptmodelzHThe style to apply to the generated image (e.g., "digital_illustration")r3   zJThe substyle to apply to the generated image, depending on the style inputr5   z6A set of custom parameters to tweak generation processzRecraftControlsObject | Nonecontrolsz4Use a previously uploaded style as a reference; UUIDr6   zDefines the difference with the original image, should lie in [0, 1], where 0 means almost identical, and 1 means miserable similarityzfloat | NonestrengthzSeed for video generationr   random_seed)r   r   r   r   r   r   r   r   r   r   r3   r5   r   r6   r   r   r   r   r   r   r   	  s   
 r   c                   @  s6   e Zd ZU edddZded< edddZded< dS )	RecraftReturnedObject.z)Unique identifier for the generated imager   r4   image_idz!URL to access the generated imageurlN)r   r   r   r   r   r   r   r   r   r   r   r     s   
 r   c                   @  s^   e Zd ZU edddZded< edddZded< edd	dZd
ed< edddZded< dS )RecraftImageGenerationResponse.z.Unix timestamp when the generation was createdr   r   createdz)Number of credits used for the generationcreditsNz$Array of generated image informationz"list[RecraftReturnedObject] | NonedatazSingle generated imagezRecraftReturnedObject | Noneimage)	r   r   r   r   r   r   r   r   r   r   r   r   r   r     r   r   c                   @  r   )RecraftCreateStyleRequest.zCrealistic_image, digital_illustration, vector_illustration, or iconr   r4   r3   N)r   r   r   r   r3   r   r   r   r   r   r   #  r   r   c                   @  r   )RecraftCreateStyleResponse.zUUID of the created styler   r4   idN)r   r   r   r   r   r   r   r   r   r   r   '  r   r   N)T)rE   r4   rF   rG   )
__future__r   enumr   pydanticr   r   r   r   r)   r2   r9   r4   r@   rL   rA   rB   rC   rD   rH   r   RECRAFT_V4_SIZESRECRAFT_V4_PRO_SIZESr   r/   r   r   r   r   r   r   r   r   r   <module>   s2    	


+
e