{
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "$id": "analogyprocedure.json",
    "title": "AnalogyProcedure",
    "type": "object",
    "description": "Procedure that finds analogs in the history of the timeseries",
    "allOf": [
        {
            "$ref": "procedure.json"
        }
    ],
    "properties": {
        "type": {
            "type": "string",
            "enum": [
                "Analogy",
                "AnalogyProcedure"
            ]
        },
        "parameters": {
            "type": "object",
            "properties": {
                "search_length": {
                    "description": "longitud de la serie para buscar Analogas",
                    "type": "integer"
                },
                "forecast_length": {
                    "description": "longitud del pronostico",
                    "type": "integer"
                },
                "order_by": {
                    "description":"Ordena Por",
                    "type": "string",
                    "enum": [
                        "Nash","CoefC","RMSE","SPEDS","ErrVol"
                    ],
                    "default": "RMSE"
                },
                "ascending": {
                    "description": "Sort ascending",
                    "type": "boolean",
                    "default": true
                },
                "number_of_analogs": {
                    "description": "Cantidad de series que toma",
                    "type": "integer",
                    "default": 5
                },
                "time_window": {
                    "description": "Ventana temporal",
                    "type": "string",
                    "enum": ["year", "month", "day", "yrDay", "wkDay"],
                    "default": "month"
                }
            },
            "required": ["search_length", "forecast_length"]
        },
        "extra_pars": {
            "type": "object",
            "$schema": "http://json-schema.org/draft-07/schema#",
            "properties": {
                "add_error_band": {
                    "type": "boolean"
                },
                "skip_first_years": {
                    "type": "number",
                    "description": "Skip first n years while running hindcast"
                },
                "only_last_years": {
                    "type": "number",
                    "description": "Run hindcast on only the last n years"
                },
                "vent_resamp_range": {
                    "type": "array",
                    "description": "Perform hindcast for forecast dates inside this range (i.e. (3,5) for march to may)",
                    "prefixItems": [
                        {
                            "type": "number"
                        },
                        {
                            "type": "number"
                        }
                    ],
                    "minItems": 2,
                    "maxItems": 2
                },
                "error_forecast_date_window": {
                    "type": "number",
                    "description": "Perform hindcast for forecast dates within this window (current forecast date plus/minus this value; i.e. if current is april, set to 1 to use march to may)"
                },
                "n_dom": {
                    "type": "number",
                    "description": "If forecast date day of month if greater than n_dom, set end date to forecast date month. Else set previous month. Default None"
                }
            }
        },
        "boundaries": {
            "type": "array",
            "items": {
                "allOf": [
                    { "$ref": "procedureboundary.json"},
                    {
                        "type": "object",
                        "properties": {
                            "name": {
                                "enum": ["input"]
                            }
                        }
                    }
                ]
            },
            "minItems": 0,
            "maxItems": 1
        },
        "outputs": {
            "type": "array",
            "items": {
                "allOf": [
                    { "$ref": "procedureboundary.json"},
                    {
                        "type": "object",
                        "properties": {
                            "name": {
                                "enum": ["output"]
                            }
                        }
                    }
                ]
            },
            "minItems": 1,
            "maxItems": 1
        }
   },
    "required": [
        "type",
        "parameters"
    ]
}