{
    "displayName": "AEC Tenders",
    "name": "aecTenders",
    "icon": "file:icons/AecTenders.svg",
    "group": ["transform"],
    "version": 1,
    "subtitle": "={{$parameter[\"operation\"]}}",
    "description": "Fetches public construction tenders from Brazil's PNCP",
    "defaults": {
        "name": "AEC Tenders"
    },
    "inputs": ["main"],
    "outputs": ["main"],
    "properties": [
        {
            "displayName": "Resource",
            "name": "resource",
            "type": "options",
            "noDataExpression": true,
            "options": [
                {
                    "name": "Tender",
                    "value": "tender"
                }
            ],
            "default": "tender"
        },
        {
            "displayName": "Operation",
            "name": "operation",
            "type": "options",
            "noDataExpression": true,
            "displayOptions": {
                "show": {
                    "resource": ["tender"]
                }
            },
            "options": [
                {
                    "name": "List by Publication Date",
                    "value": "listByPublicationDate",
                    "description": "Get tenders published within a date range",
                    "action": "List tenders by publication date"
                },
                {
                    "name": "List with Open Proposals",
                    "value": "listWithOpenProposals",
                    "description": "Get tenders currently accepting proposals",
                    "action": "List tenders with open proposals"
                },
                {
                    "name": "Get By ID",
                    "value": "getById",
                    "description": "Get detailed information about a specific tender",
                    "action": "Get tender details by ID"
                },
                {
                    "name": "Search by Keyword",
                    "value": "searchByKeyword",
                    "description": "Search tenders by keywords in the contract object",
                    "action": "Search tenders by keyword"
                }
            ],
            "default": "listByPublicationDate"
        },
        {
            "displayName": "Start Date",
            "name": "startDate",
            "type": "dateTime",
            "displayOptions": {
                "show": {
                    "resource": ["tender"],
                    "operation": ["listByPublicationDate", "searchByKeyword"]
                }
            },
            "default": "",
            "placeholder": "2025-01-01",
            "description": "Start date for the search in YYYY-MM-DD format (e.g., 2025-01-01)",
            "required": true
        },
        {
            "displayName": "End Date",
            "name": "endDate",
            "type": "dateTime",
            "displayOptions": {
                "show": {
                    "resource": ["tender"],
                    "operation": ["listByPublicationDate", "searchByKeyword"]
                }
            },
            "default": "",
            "placeholder": "2025-12-31",
            "description": "End date for the search in YYYY-MM-DD format (e.g., 2025-12-31)",
            "required": true
        },
        {
            "displayName": "State (UF)",
            "name": "stateUf",
            "type": "string",
            "displayOptions": {
                "show": {
                    "resource": ["tender"],
                    "operation": ["listWithOpenProposals"]
                }
            },
            "default": "",
            "placeholder": "SP",
            "description": "Optional: Brazilian state code (e.g., SP, RJ, MG)"
        },
        {
            "displayName": "Procuring Entity CNPJ",
            "name": "procuringEntityCNPJ",
            "type": "string",
            "displayOptions": {
                "show": {
                    "resource": ["tender"],
                    "operation": ["getById"]
                }
            },
            "default": "",
            "placeholder": "12345678000190",
            "description": "The CNPJ must be exactly 14 digits without formatting (e.g., 12345678000190)",
            "required": true
        },
        {
            "displayName": "Year",
            "name": "year",
            "type": "number",
            "displayOptions": {
                "show": {
                    "resource": ["tender"],
                    "operation": ["getById"]
                }
            },
            "default": 2024,
            "description": "Year of the tender",
            "required": true
        },
        {
            "displayName": "Sequence Number",
            "name": "sequenceNumber",
            "type": "number",
            "displayOptions": {
                "show": {
                    "resource": ["tender"],
                    "operation": ["getById"]
                }
            },
            "default": 1,
            "description": "Sequential number of the tender",
            "required": true
        },
        {
            "displayName": "Keywords",
            "name": "keywords",
            "type": "string",
            "displayOptions": {
                "show": {
                    "resource": ["tender"],
                    "operation": ["searchByKeyword"]
                }
            },
            "default": "",
            "placeholder": "engenharia, constru��o, reforma",
            "description": "Keywords to search in tender descriptions, separated by commas (e.g., engenharia, construção, reforma)",
            "required": true
        },
        {
            "displayName": "Return All",
            "name": "returnAll",
            "type": "boolean",
            "displayOptions": {
                "show": {
                    "resource": ["tender"],
                    "operation": ["listByPublicationDate", "listWithOpenProposals", "searchByKeyword"]
                }
            },
            "default": false,
            "description": "Whether to return all results or limit the number of results"
        },
        {
            "displayName": "Limit",
            "name": "limit",
            "type": "number",
            "displayOptions": {
                "show": {
                    "resource": ["tender"],
                    "operation": ["listByPublicationDate", "listWithOpenProposals", "searchByKeyword"],
                    "returnAll": [false]
                }
            },
            "typeOptions": {
                "minValue": 1,
                "maxValue": 500
            },
            "default": 50,
            "description": "Max number of results to return"
        }
    ]
}
