{
  "name": "immich-plugin-core",
  "version": "2.0.1",
  "title": "Immich Core Plugin",
  "description": "Core workflow capabilities for Immich",
  "author": "Immich Team",
  "wasmPath": "dist/plugin.wasm",
  "templates": [
    {
      "name": "screenshots-smart-album",
      "title": "Archive screenshots",
      "description": "Archive uploads with \"screenshot\" in the filename and optionally add them to an album",
      "trigger": "AssetCreate",
      "steps": [
        {
          "method": "immich-plugin-core#assetFileFilter",
          "config": {
            "pattern": "screenshot",
            "matchType": "contains",
            "caseSensitive": false
          }
        },
        {
          "method": "immich-plugin-core#assetArchive",
          "config": {
            "inverse": false
          }
        },
        {
          "method": "immich-plugin-core#assetAddToAlbums",
          "config": {
            "albumName": "Screenshots",
            "albumIds": []
          }
        }
      ],
      "uiHints": ["SmartAlbum"]
    },
    {
      "name": "missing-timezone-smart-album",
      "title": "Missing timezone",
      "description": "Automatically create an album for assets without a time zone",
      "trigger": "AssetMetadataExtraction",
      "steps": [
        {
          "method": "immich-plugin-core#assetMissingTimeZoneFilter",
          "config": {}
        },
        {
          "method": "immich-plugin-core#assetAddToAlbums",
          "config": {
            "albumName": "Missing time zone",
            "albumIds": []
          }
        }
      ],
      "uiHints": ["SmartAlbum"]
    },
    {
      "name": "location-smart-album",
      "title": "Location-based album",
      "description": "Automatically add assets taken in a specific location to an album",
      "trigger": "AssetMetadataExtraction",
      "steps": [
        {
          "method": "immich-plugin-core#assetLocationFilter",
          "config": { "region": { "city": "Vancouver", "state": "British Columbia", "country": "Canada" } }
        },
        {
          "method": "immich-plugin-core#assetAddToAlbums",
          "config": {
            "albumName": "Vancouver photos & videos",
            "albumIds": []
          }
        }
      ],
      "uiHints": ["SmartAlbum"]
    }
  ],
  "methods": [
    {
      "name": "assetFileFilter",
      "title": "Filter by filename",
      "description": "Filter assets by filename pattern using text matching or regular expressions",
      "types": ["AssetV1"],
      "schema": {
        "type": "object",
        "properties": {
          "pattern": {
            "type": "string",
            "title": "Filename pattern",
            "description": "Text or regex pattern to match against filename"
          },
          "matchType": {
            "type": "string",
            "title": "Match type",
            "enum": ["contains", "startsWith", "exact", "regex"],
            "default": "contains",
            "description": "Type of pattern matching to perform"
          },
          "caseSensitive": {
            "type": "boolean",
            "default": false,
            "title": "Case sensitive",
            "description": "Whether matching should be case-sensitive"
          }
        },
        "required": ["pattern"]
      },
      "uiHints": ["Filter"]
    },
    {
      "name": "assetMissingTimeZoneFilter",
      "title": "Filter by missing time zone",
      "description": "Filter assets that have no time zone information",
      "types": ["AssetV1"],
      "schema": {
        "type": "object",
        "properties": {
          "inverse": {
            "type": "boolean",
            "title": "Inverse",
            "description": "Missing by default, set to true to filter assets with a time zone",
            "default": false
          }
        }
      },
      "uiHints": ["Filter"]
    },
    {
      "name": "assetLocationFilter",
      "title": "Filter assets by geolocation",
      "description": "Filter assets by where they were taken",
      "types": ["AssetV1"],
      "schema": {
        "type": "object",
        "properties": {
          "region": {
            "type": "object",
            "title": "Region",
            "description": "Filter by region name",
            "properties": {
              "country": {
                "type": "string",
                "title": "Country",
                "description": "Exact name of the country the asset must be taken in"
              },
              "state": {
                "type": "string",
                "title": "State/province",
                "description": "Exact name of the state/province the asset must be taken in"
              },
              "city": {
                "type": "string",
                "title": "City",
                "description": "Exact name of the city the asset must be taken in"
              }
            }
          },
          "coordinate": {
            "type": "object",
            "title": "Coordinate",
            "description": "Filter by distance to a coordinate",
            "properties": {
              "latitude": {
                "type": "string",
                "title": "Latitude",
                "description": "GPS latitude of a coordinate which the asset must be close to"
              },
              "longitude": {
                "type": "string",
                "title": "Longitude",
                "description": "GPS longitude of a coordinate which the asset must be close to"
              },
              "radius": {
                "type": "number",
                "title": "Maximum distance",
                "description": "How close in kilometres the asset must be to the given point"
              }
            }
          }
        }
      },
      "uiHints": ["Filter"]
    },
    {
      "name": "assetTypeFilter",
      "title": "Filter by asset type",
      "description": "Filter assets by type",
      "types": ["AssetV1"],
      "schema": {
        "type": "object",
        "properties": {
          "allowedTypes": {
            "title": "Asset types",
            "description": "Allowed asset types",
            "type": "string",
            "array": true,
            "enum": ["IMAGE", "VIDEO", "AUDIO", "OTHER"]
          }
        },
        "required": ["allowedTypes"]
      },
      "uiHints": ["Filter"]
    },
    {
      "name": "assetArchive",
      "title": "Archive asset",
      "description": "Change asset visibility to archive",
      "types": ["AssetV1"],
      "schema": {
        "properties": {
          "inverse": {
            "title": "Inverse",
            "description": "When true will unarchive any archived assets",
            "type": "boolean"
          }
        }
      }
    },
    {
      "name": "assetLock",
      "title": "Move to locked folder",
      "description": "Change visibility to locked",
      "types": ["AssetV1"],
      "schema": {
        "properties": {
          "inverse": {
            "title": "Inverse",
            "description": "When true will unarchive any archived assets",
            "type": "boolean"
          }
        }
      }
    },
    {
      "name": "assetVisibility",
      "title": "Update visibility",
      "description": "Change visibility to selected option",
      "types": ["AssetV1"],
      "schema": {
        "properties": {
          "visibility": {
            "title": "Visibility",
            "description": "Asset visibility",
            "type": "string",
            "enum": ["archive", "timeline", "locked"]
          }
        },
        "required": ["visibility"]
      }
    },
    {
      "name": "assetFavorite",
      "title": "Favorite",
      "description": "Favorite an asset",
      "types": ["AssetV1"],
      "schema": {
        "type": "object",
        "properties": {
          "inverse": {
            "type": "boolean",
            "title": "Inverse",
            "description": "Unfavorite by default, set to true to favorite instead",
            "default": false
          }
        }
      }
    },
    {
      "name": "assetAddToAlbums",
      "title": "Add to Album(s)",
      "description": "Add asset to selected albums",
      "types": ["AssetV1"],
      "hostFunctions": true,
      "schema": {
        "type": "object",
        "properties": {
          "albumIds": {
            "type": "string",
            "title": "Album IDs",
            "array": true,
            "description": "Target album IDs",
            "uiHint": {
              "type": "AlbumId"
            }
          },
          "albumName": {
            "type": "string",
            "title": "Album name",
            "description": "Use an album with this name if one exists, otherwise create a new one"
          }
        },
        "required": ["albumIds"]
      }
    },
    {
      "name": "webhook",
      "title": "Trigger Webhook",
      "description": "POST/PUT event data to any URL",
      "types": ["AssetV1"],
      "hostFunctions": true,
      "allowedHosts": ["*"],
      "schema": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "title": "URL",
            "description": "Event data will be PUT/POSTed to this URL as a JSON object"
          },
          "headerName": {
            "type": "string",
            "title": "Header name",
            "description": "The name of an additional header to include with the request (e.g. authentication)"
          },
          "headerValue": {
            "type": "string",
            "title": "Header value",
            "description": "The value of the additional header"
          },
          "method": {
            "type": "string",
            "title": "Method",
            "description": "The HTTP method to use in the request",
            "enum": ["POST", "PUT"]
          }
        },
        "required": ["url"]
      }
    }
  ]
}
