o
    cj                     @   s  d dl mZmZmZmZmZmZ d dlmZm	Z	m
Z
 d dlmZmZ d dlmZ G dd deeZG dd de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G dd deZG dd deZG dd deZdS )    )	BaseModelFieldfield_validatorEmailStrValidationInfomodel_validator)OptionalListLiteral)datetimedate)Enumc                   @   s   e Zd ZdZdZdZdS )SortDirectionzEnumeration for sort directionsascdescN)__name__
__module____qualname____doc__ASCDESC r   r   9/var/www/html/oms-prod-mcp/app/schemas/request_schemas.pyr      s    r   c                   @   s   e Zd ZdZdZdZdZdS )DatabaseTypezEnumeration for database typesmysqlmongodb	cassandraN)r   r   r   r   MYSQLMONGODB	CASSANDRAr   r   r   r   r      s
    r   c                   @   sN   e Zd ZU dZedddZeed< edddZe	ed< e
dedd	 Zd
S )TimeSeriesDataPointz*Schema for a single time series data point.z@Date/timestamp in ISO format (YYYY-MM-DD or YYYY-MM-DD HH:MM:SS)descriptiondsz!Numeric value for the time seriesyc                 C   s0   zt |dd |W S  ty   tdw )zValidate date formatZz+00:00z>Date must be in ISO format (YYYY-MM-DD or YYYY-MM-DD HH:MM:SS))r   fromisoformatreplace
ValueError)clsvr   r   r   validate_date   s   z!TimeSeriesDataPoint.validate_dateN)r   r   r   r   r   r#   str__annotations__r$   floatr   classmethodr+   r   r   r   r   r       s   
 r    c                   @   s  e Zd ZU dZedddZeed  ed< edddZ	ee
 ed	< edd
dZee
 ed< edddZee
 ed< edddddZee ed< edddddZee ed< edddddZee ed< edddddZee ed < edddd!dZee ed"< d#S )$ProphetConfigz&Schema for Prophet model configurationadditivezSeasonality moder!   )r1   multiplicativeseasonality_modeTzEnable yearly seasonalityyearly_seasonalityzEnable weekly seasonalityweekly_seasonalityFzEnable daily seasonalitydaily_seasonalityg?gMbP?2   zChangepoint prior scalegeler"   changepoint_prior_scaleg      $@g{Gz?d   zSeasonality prior scaleseasonality_prior_scalezHolidays prior scaleholidays_prior_scaleg?g        g      ?zChangepoint rangechangepoint_rangeu!   Confidence interval width (0–1)interval_widthN)r   r   r   r   r   r3   r   r
   r-   r4   boolr5   r6   r;   r.   r=   r>   r?   r@   r   r   r   r   r0   )   s.   
 r0   c                   @   s`   e Zd ZU dZeddddZee ed< eddd	d
dZ	e
e ed< edddZe
e ed< dS )ProphetTrainRequestz#Schema for training a Prophet model.   zTime series data points
min_lengthr"   dataN   r<   zOptional model identifier)rE   
max_lengthr"   model_idzProphet model configurationr!   config)r   r   r   r   r   rF   r	   r    r-   rI   r   r,   rJ   r0   r   r   r   r   rB   C   s
   
 rB   c                   @   sb   e Zd ZU dZedddddZee ed< edd	d
Z	ee
d  ed< eddd
Zee ed< dS )ProphetForecastRequestzSchema for generating forecasts   rG   m  Number of periods to forecastr8   periodsDForecast frequencyr!   rP   HWMQYfreqTz#Include historical data in responseinclude_historyN)r   r   r   r   r   rO   r   intr-   rX   r
   rY   rA   r   r   r   r   rK   K   s
   
 rK   c                   @   s   e Zd ZU dZedddddZee ed< edd	d
Z	ee
d  ed< edddddZee ed< edddddZee ed< dS )ProphetPlotRequestz$Schema for generating forecast plotsrL   rG   rM   rN   r8   rO   rP   rQ   r!   rR   rX   i   i  i  zPlot width in pixelswidthiX  i,  i  zPlot height in pixelsheightN)r   r   r   r   r   rO   r   rZ   r-   rX   r
   r\   r]   r   r   r   r   r[   S   s   
  r[   c                   @   s,   e Zd ZU dZeddddZee ed< dS )ProphetValidateRequestz&Schema for validating time series data.rG   z#Time series data points to validaterD   rF   N)	r   r   r   r   r   rF   r	   r    r-   r   r   r   r   r^   \   s   
 r^   c                   @   s@   e Zd ZU dZeddddZeed< eddd	Ze	e
 ed
< dS )RegressionTrainRequestz8Schema for training a regression or classification model.r   z!Company ID to scope training datagtr"   
company_idNz)Optional XGBoost hyperparameter overridesr!   rJ   )r   r   r   r   r   rb   rZ   r-   rJ   r   dictr   r   r   r   r_   d   s   
 r_   c                   @   sD   e Zd ZU dZeddddZeed< eddd	Ze	e
e  ed
< dS )CollectionRiskScoreRequestz)Schema for scoring client collection risk.r   
Company IDr`   rb   Nz*Specific client IDs to score; omit for allr!   
client_ids)r   r   r   r   r   rb   rZ   r-   rf   r   r	   r   r   r   r   rd   j   s   
  rd   c                   @   sv   e Zd ZU dZeddddZeed< eddddZeed< ed	d
dZ	e
ee  ed< ed	ddZe
ee  ed< d	S )SalesTargetPredictRequestz-Schema for predicting sales target attainment.r   re   r`   rb   zAccount year to predict foraccount_year_idNzFilter by product head IDsr!   product_head_idszFilter by district IDsdistrict_ids)r   r   r   r   r   rb   rZ   r-   rh   ri   r   r	   rj   r   r   r   r   rg   p   s   
  rg   N)pydanticr   r   r   r   r   r   typingr   r	   r
   r   r   enumr   r,   r   r   r    r0   rB   rK   r[   r^   r_   rd   rg   r   r   r   r   <module>   s     		