{
  "i18n": true,
  "type": "tabs",
  "items": {
    "general": {
      "type": "panel",
      "label": "General Settings",
      "items": {
        "_port": {
          "type": "header",
          "text": "Web Server",
          "size": 3
        },
        "bind": {
          "type": "ip",
          "listenOnAllPorts": true,
          "label": "Bind IP address",
          "help": "Select IP address to bind the web server to.",
          "xs": 12,
          "sm": 12,
          "md": 6,
          "lg": 4,
          "xl": 4
        },
        "port": {
          "type": "number",
          "label": "Port",
          "min": 1024,
          "max": 65535,
          "default": 3000,
          "help": "Port for the web server (PWA application)",
          "xs": 12,
          "sm": 12,
          "md": 6,
          "lg": 4,
          "xl": 4
        },
        "dbToken": {
          "type": "password",
          "label": "label_dbToken",
          "help": "help_dbToken",
          "xs": 12,
          "sm": 12,
          "md": 6,
          "lg": 4,
          "xl": 4
        },
        "_apiKeys": {
          "type": "header",
          "text": "API Configuration",
          "size": 3
        },
        "apiKeys": {
          "type": "table",
          "label": "API Keys",
          "help": "help_apiKeys",
          "items": [
            {
              "type": "text",
              "title": "API Key",
              "attr": "key",
              "width": "40%"
            },
            {
              "type": "number",
              "title": "Year From",
              "attr": "yearStart",
              "width": "15%",
              "default": 2020
            },
            {
              "type": "number",
              "title": "Year To",
              "attr": "yearEnd",
              "width": "15%"
            },
            {
              "type": "number",
              "title": "Min Votes",
              "attr": "minVotes",
              "width": "15%",
              "default": 1000
            },
            {
              "type": "number",
              "title": "Min Rating",
              "attr": "minRating",
              "width": "15%",
              "default": 5
            }
          ],
          "xs": 12,
          "sm": 12,
          "md": 12,
          "lg": 12,
          "xl": 12
        },
        "_info": {
          "type": "staticText",
          "text": "Get your API key at: https://api.kinopoisk.dev/",
          "style": {
            "fontSize": "12px",
            "fontStyle": "italic",
            "color": "#888"
          },
          "xs": 12,
          "sm": 12,
          "md": 12,
          "lg": 12,
          "xl": 12
        },
        "useEuServer": {
          "type": "checkbox",
          "label": "label_useEuServer",
          "help": "help_useEuServer",
          "default": false,
          "xs": 12,
          "sm": 12,
          "md": 12,
          "lg": 12,
          "xl": 12
        }
      }
    },
    "sync": {
      "type": "panel",
      "label": "Synchronization",
      "items": {
        "_advanced": {
          "type": "header",
          "text": "Advanced Settings",
          "size": 3
        },
        "maxRequestsPerRun": {
          "type": "number",
          "label": "Max Requests per Run",
          "min": 1,
          "max": 1000,
          "default": 250,
          "help": "Maximum API requests per synchronization run (default: 250 for free tier, up to 1000 for premium)",
          "xs": 12,
          "sm": 12,
          "md": 6,
          "lg": 6,
          "xl": 6
        },
        "dailyRequestLimit": {
          "type": "number",
          "label": "Daily Request Limit",
          "min": 1,
          "max": 10000,
          "default": 200,
          "help": "Total API requests allowed per day (default: 200 for free tier, higher for premium keys)",
          "xs": 12,
          "sm": 12,
          "md": 6,
          "lg": 6,
          "xl": 6
        },
        "autoSync": {
          "type": "checkbox",
          "label": "Auto Sync",
          "help": "Automatically synchronize on adapter start",
          "default": false,
          "xs": 12,
          "sm": 12,
          "md": 6,
          "lg": 6,
          "xl": 6
        },
        "syncScheduled": {
          "type": "checkbox",
          "label": "label_syncScheduled",
          "help": "help_syncScheduled",
          "default": false,
          "hidden": "!data.autoSync",
          "xs": 12,
          "sm": 12,
          "md": 6,
          "lg": 6,
          "xl": 6
        },
        "syncInterval": {
          "type": "number",
          "label": "Sync Interval",
          "min": 1,
          "max": 168,
          "default": 24,
          "unit": "hours",
          "help": "Interval between automatic synchronizations (if Auto Sync is enabled)",
          "hidden": "!data.autoSync || data.syncScheduled",
          "xs": 12,
          "sm": 12,
          "md": 6,
          "lg": 6,
          "xl": 6
        },
        "syncScheduledTime": {
          "type": "text",
          "label": "label_syncScheduledTime",
          "help": "help_syncScheduledTime",
          "default": "03:00",
          "hidden": "!data.autoSync || !data.syncScheduled",
          "xs": 12,
          "sm": 12,
          "md": 6,
          "lg": 6,
          "xl": 6
        },
        "preserveSyncProgress": {
          "type": "checkbox",
          "label": "Continue sync from last position",
          "help": "If enabled, sync will continue from where it stopped. If disabled, sync will always start from the beginning.",
          "default": true,
          "xs": 12,
          "sm": 12,
          "md": 6,
          "lg": 6,
          "xl": 6
        },
        "preserveDatabase": {
          "type": "checkbox",
          "label": "Preserve existing database on update",
          "help": "If enabled, your custom database will not be overwritten when updating the adapter. Disable to reset to default database.",
          "default": true,
          "xs": 12,
          "sm": 12,
          "md": 6,
          "lg": 6,
          "xl": 6
        }
      }
    },
    "status": {
      "type": "panel",
      "label": "Status",
      "items": {
        "_serverStatus": {
          "type": "header",
          "text": "Web Server Status",
          "size": 3
        },
        "_serverUrl": {
          "type": "staticLink",
          "href": "http://localhost:${data.port}",
          "text": "http://localhost:${data.port}",
          "label": "Application URL",
          "xs": 12, "sm": 12, "md": 12, "lg": 12, "xl": 12
        },
        "_serverNote": {
          "type": "staticText",
          "text": "Replace 'localhost' with your server IP if accessing remotely. Actual URL with IP: Objects → movieswipe.0 → server → url",
          "style": { "fontSize": "12px", "fontStyle": "italic", "color": "#888" },
          "xs": 12, "sm": 12, "md": 12, "lg": 12, "xl": 12
        },
        "_dbHeader": {
          "type": "header",
          "text": "Database Backup",
          "size": 3
        },
        "_dbBackupUrl": {
          "type": "staticLink",
          "href": "http://localhost:${data.port}/backup.html",
          "text": "http://localhost:${data.port}/backup.html",
          "label": "Backup Manager",
          "xs": 12, "sm": 12, "md": 12, "lg": 12, "xl": 12
        },
        "_dbNote": {
          "type": "staticText",
          "text": "Replace 'localhost' with your server IP if accessing remotely.",
          "style": { "fontSize": "12px", "fontStyle": "italic", "color": "#888" },
          "xs": 12, "sm": 12, "md": 12, "lg": 12, "xl": 12
        },
        "_syncStatus": {
          "type": "header",
          "text": "Synchronization Status",
          "size": 3
        },
        "_totalMoviesInfo": {
          "type": "staticText",
          "text": "Total movies in database: Check 'sync.totalMovies' state in Objects tab",
          "xs": 12,
          "sm": 12,
          "md": 12,
          "lg": 12,
          "xl": 12
        },
        "_syncInfo": {
          "type": "staticText",
          "text": "Use the 'sync.start' state to trigger synchronization. After sync completes, refresh the app (F5) to see new movies.",
          "xs": 12,
          "sm": 12,
          "md": 12,
          "lg": 12,
          "xl": 12
        },
        "_help": {
          "type": "header",
          "text": "Help",
          "size": 3
        },
        "_helpText": {
          "type": "staticText",
          "text": "For more information, visit the <a href='https://github.com/sadam6752-tech/ioBroker.movieswipe' target='_blank'>GitHub repository</a>.",
          "xs": 12,
          "sm": 12,
          "md": 12,
          "lg": 12,
          "xl": 12
        }
      }
    }
  }
}
