# coding=utf-8
# *** WARNING: this file was generated by pulumi-language-python. ***
# *** Do not edit by hand unless you're certain you know what you are doing! ***

import builtins as _builtins
import warnings
import sys
import pulumi
import pulumi.runtime
from typing import Any, Mapping, Optional, Sequence, Union, overload
if sys.version_info >= (3, 11):
    from typing import NotRequired, TypedDict, TypeAlias
else:
    from typing_extensions import NotRequired, TypedDict, TypeAlias
from . import _utilities

__all__ = ['AssetArgs', 'Asset']

@pulumi.input_type
class AssetArgs:
    def __init__(__self__, *,
                 file_hash: pulumi.Input[_builtins.str],
                 file_name: pulumi.Input[_builtins.str],
                 site_id: pulumi.Input[_builtins.str],
                 file_source: Optional[pulumi.Input[_builtins.str]] = None,
                 parent_folder: Optional[pulumi.Input[_builtins.str]] = None):
        """
        The set of arguments for constructing a Asset resource.
        :param pulumi.Input[_builtins.str] file_hash: MD5 hash of the file content (required). Webflow uses this hash to identify and deduplicate assets. Generate using: md5sum <filename> (Linux) or md5 <filename> (macOS). Example: 'd41d8cd98f00b204e9800998ecf8427e'.
        :param pulumi.Input[_builtins.str] file_name: The name of the file to upload, including the extension. Examples: 'logo.png', 'hero-image.jpg', 'document.pdf'. The file name must not exceed 255 characters and should not contain invalid characters (<, >, :, ", |, ?, *).
        :param pulumi.Input[_builtins.str] site_id: The Webflow site ID (24-character lowercase hexadecimal string, e.g., '5f0c8c9e1c9d440000e8d8c3'). You can find your site ID in the Webflow dashboard under Site Settings. This field will be validated before making any API calls.
        :param pulumi.Input[_builtins.str] file_source: The source of the file to upload. For the current implementation, this is a reference field. In future versions, this may support URLs or local file paths for automatic upload. Examples: 'https://example.com/logo.png', '/path/to/local/file.png'.
        :param pulumi.Input[_builtins.str] parent_folder: Optional folder ID where the asset will be organized in the Webflow Assets panel. If not specified, the asset will be placed at the root level. Example: '5f0c8c9e1c9d440000e8d8c4'.
        """
        pulumi.set(__self__, "file_hash", file_hash)
        pulumi.set(__self__, "file_name", file_name)
        pulumi.set(__self__, "site_id", site_id)
        if file_source is not None:
            pulumi.set(__self__, "file_source", file_source)
        if parent_folder is not None:
            pulumi.set(__self__, "parent_folder", parent_folder)

    @_builtins.property
    @pulumi.getter(name="fileHash")
    def file_hash(self) -> pulumi.Input[_builtins.str]:
        """
        MD5 hash of the file content (required). Webflow uses this hash to identify and deduplicate assets. Generate using: md5sum <filename> (Linux) or md5 <filename> (macOS). Example: 'd41d8cd98f00b204e9800998ecf8427e'.
        """
        return pulumi.get(self, "file_hash")

    @file_hash.setter
    def file_hash(self, value: pulumi.Input[_builtins.str]):
        pulumi.set(self, "file_hash", value)

    @_builtins.property
    @pulumi.getter(name="fileName")
    def file_name(self) -> pulumi.Input[_builtins.str]:
        """
        The name of the file to upload, including the extension. Examples: 'logo.png', 'hero-image.jpg', 'document.pdf'. The file name must not exceed 255 characters and should not contain invalid characters (<, >, :, ", |, ?, *).
        """
        return pulumi.get(self, "file_name")

    @file_name.setter
    def file_name(self, value: pulumi.Input[_builtins.str]):
        pulumi.set(self, "file_name", value)

    @_builtins.property
    @pulumi.getter(name="siteId")
    def site_id(self) -> pulumi.Input[_builtins.str]:
        """
        The Webflow site ID (24-character lowercase hexadecimal string, e.g., '5f0c8c9e1c9d440000e8d8c3'). You can find your site ID in the Webflow dashboard under Site Settings. This field will be validated before making any API calls.
        """
        return pulumi.get(self, "site_id")

    @site_id.setter
    def site_id(self, value: pulumi.Input[_builtins.str]):
        pulumi.set(self, "site_id", value)

    @_builtins.property
    @pulumi.getter(name="fileSource")
    def file_source(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        The source of the file to upload. For the current implementation, this is a reference field. In future versions, this may support URLs or local file paths for automatic upload. Examples: 'https://example.com/logo.png', '/path/to/local/file.png'.
        """
        return pulumi.get(self, "file_source")

    @file_source.setter
    def file_source(self, value: Optional[pulumi.Input[_builtins.str]]):
        pulumi.set(self, "file_source", value)

    @_builtins.property
    @pulumi.getter(name="parentFolder")
    def parent_folder(self) -> Optional[pulumi.Input[_builtins.str]]:
        """
        Optional folder ID where the asset will be organized in the Webflow Assets panel. If not specified, the asset will be placed at the root level. Example: '5f0c8c9e1c9d440000e8d8c4'.
        """
        return pulumi.get(self, "parent_folder")

    @parent_folder.setter
    def parent_folder(self, value: Optional[pulumi.Input[_builtins.str]]):
        pulumi.set(self, "parent_folder", value)


@pulumi.type_token("webflow:index:Asset")
class Asset(pulumi.CustomResource):
    @overload
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 file_hash: Optional[pulumi.Input[_builtins.str]] = None,
                 file_name: Optional[pulumi.Input[_builtins.str]] = None,
                 file_source: Optional[pulumi.Input[_builtins.str]] = None,
                 parent_folder: Optional[pulumi.Input[_builtins.str]] = None,
                 site_id: Optional[pulumi.Input[_builtins.str]] = None,
                 __props__=None):
        """
        Manages assets (images, files, documents) for a Webflow site. This resource allows you to upload and manage files that can be used in your Webflow site. Note: Assets are immutable - changing any property will delete and recreate the asset.

        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[_builtins.str] file_hash: MD5 hash of the file content (required). Webflow uses this hash to identify and deduplicate assets. Generate using: md5sum <filename> (Linux) or md5 <filename> (macOS). Example: 'd41d8cd98f00b204e9800998ecf8427e'.
        :param pulumi.Input[_builtins.str] file_name: The name of the file to upload, including the extension. Examples: 'logo.png', 'hero-image.jpg', 'document.pdf'. The file name must not exceed 255 characters and should not contain invalid characters (<, >, :, ", |, ?, *).
        :param pulumi.Input[_builtins.str] file_source: The source of the file to upload. For the current implementation, this is a reference field. In future versions, this may support URLs or local file paths for automatic upload. Examples: 'https://example.com/logo.png', '/path/to/local/file.png'.
        :param pulumi.Input[_builtins.str] parent_folder: Optional folder ID where the asset will be organized in the Webflow Assets panel. If not specified, the asset will be placed at the root level. Example: '5f0c8c9e1c9d440000e8d8c4'.
        :param pulumi.Input[_builtins.str] site_id: The Webflow site ID (24-character lowercase hexadecimal string, e.g., '5f0c8c9e1c9d440000e8d8c3'). You can find your site ID in the Webflow dashboard under Site Settings. This field will be validated before making any API calls.
        """
        ...
    @overload
    def __init__(__self__,
                 resource_name: str,
                 args: AssetArgs,
                 opts: Optional[pulumi.ResourceOptions] = None):
        """
        Manages assets (images, files, documents) for a Webflow site. This resource allows you to upload and manage files that can be used in your Webflow site. Note: Assets are immutable - changing any property will delete and recreate the asset.

        :param str resource_name: The name of the resource.
        :param AssetArgs args: The arguments to use to populate this resource's properties.
        :param pulumi.ResourceOptions opts: Options for the resource.
        """
        ...
    def __init__(__self__, resource_name: str, *args, **kwargs):
        resource_args, opts = _utilities.get_resource_args_opts(AssetArgs, pulumi.ResourceOptions, *args, **kwargs)
        if resource_args is not None:
            __self__._internal_init(resource_name, opts, **resource_args.__dict__)
        else:
            __self__._internal_init(resource_name, *args, **kwargs)

    def _internal_init(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 file_hash: Optional[pulumi.Input[_builtins.str]] = None,
                 file_name: Optional[pulumi.Input[_builtins.str]] = None,
                 file_source: Optional[pulumi.Input[_builtins.str]] = None,
                 parent_folder: Optional[pulumi.Input[_builtins.str]] = None,
                 site_id: Optional[pulumi.Input[_builtins.str]] = None,
                 __props__=None):
        opts = pulumi.ResourceOptions.merge(_utilities.get_resource_opts_defaults(), opts)
        if not isinstance(opts, pulumi.ResourceOptions):
            raise TypeError('Expected resource options to be a ResourceOptions instance')
        if opts.id is None:
            if __props__ is not None:
                raise TypeError('__props__ is only valid when passed in combination with a valid opts.id to get an existing resource')
            __props__ = AssetArgs.__new__(AssetArgs)

            if file_hash is None and not opts.urn:
                raise TypeError("Missing required property 'file_hash'")
            __props__.__dict__["file_hash"] = file_hash
            if file_name is None and not opts.urn:
                raise TypeError("Missing required property 'file_name'")
            __props__.__dict__["file_name"] = file_name
            __props__.__dict__["file_source"] = file_source
            __props__.__dict__["parent_folder"] = parent_folder
            if site_id is None and not opts.urn:
                raise TypeError("Missing required property 'site_id'")
            __props__.__dict__["site_id"] = site_id
            __props__.__dict__["asset_id"] = None
            __props__.__dict__["asset_url"] = None
            __props__.__dict__["content_type"] = None
            __props__.__dict__["created_on"] = None
            __props__.__dict__["hosted_url"] = None
            __props__.__dict__["last_updated"] = None
            __props__.__dict__["size"] = None
            __props__.__dict__["upload_details"] = None
            __props__.__dict__["upload_url"] = None
        super(Asset, __self__).__init__(
            'webflow:index:Asset',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name: str,
            id: pulumi.Input[str],
            opts: Optional[pulumi.ResourceOptions] = None) -> 'Asset':
        """
        Get an existing Asset resource's state with the given name, id, and optional extra
        properties used to qualify the lookup.

        :param str resource_name: The unique name of the resulting resource.
        :param pulumi.Input[str] id: The unique provider ID of the resource to lookup.
        :param pulumi.ResourceOptions opts: Options for the resource.
        """
        opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id))

        __props__ = AssetArgs.__new__(AssetArgs)

        __props__.__dict__["asset_id"] = None
        __props__.__dict__["asset_url"] = None
        __props__.__dict__["content_type"] = None
        __props__.__dict__["created_on"] = None
        __props__.__dict__["file_hash"] = None
        __props__.__dict__["file_name"] = None
        __props__.__dict__["file_source"] = None
        __props__.__dict__["hosted_url"] = None
        __props__.__dict__["last_updated"] = None
        __props__.__dict__["parent_folder"] = None
        __props__.__dict__["site_id"] = None
        __props__.__dict__["size"] = None
        __props__.__dict__["upload_details"] = None
        __props__.__dict__["upload_url"] = None
        return Asset(resource_name, opts=opts, __props__=__props__)

    @_builtins.property
    @pulumi.getter(name="assetId")
    def asset_id(self) -> pulumi.Output[Optional[_builtins.str]]:
        """
        The Webflow-assigned asset ID (read-only). This unique identifier can be used to reference the asset in API calls.
        """
        return pulumi.get(self, "asset_id")

    @_builtins.property
    @pulumi.getter(name="assetUrl")
    def asset_url(self) -> pulumi.Output[Optional[_builtins.str]]:
        """
        The direct S3 URL for the asset (read-only). This is the raw S3 location where the file is stored.
        """
        return pulumi.get(self, "asset_url")

    @_builtins.property
    @pulumi.getter(name="contentType")
    def content_type(self) -> pulumi.Output[Optional[_builtins.str]]:
        """
        The MIME type of the asset (read-only). Examples: 'image/png', 'image/jpeg', 'application/pdf'. Determined by the fileName extension.
        """
        return pulumi.get(self, "content_type")

    @_builtins.property
    @pulumi.getter(name="createdOn")
    def created_on(self) -> pulumi.Output[Optional[_builtins.str]]:
        """
        The timestamp when the asset metadata was created (RFC3339 format, read-only). This is set when the asset is registered with Webflow.
        """
        return pulumi.get(self, "created_on")

    @_builtins.property
    @pulumi.getter(name="fileHash")
    def file_hash(self) -> pulumi.Output[_builtins.str]:
        """
        MD5 hash of the file content (required). Webflow uses this hash to identify and deduplicate assets. Generate using: md5sum <filename> (Linux) or md5 <filename> (macOS). Example: 'd41d8cd98f00b204e9800998ecf8427e'.
        """
        return pulumi.get(self, "file_hash")

    @_builtins.property
    @pulumi.getter(name="fileName")
    def file_name(self) -> pulumi.Output[_builtins.str]:
        """
        The name of the file to upload, including the extension. Examples: 'logo.png', 'hero-image.jpg', 'document.pdf'. The file name must not exceed 255 characters and should not contain invalid characters (<, >, :, ", |, ?, *).
        """
        return pulumi.get(self, "file_name")

    @_builtins.property
    @pulumi.getter(name="fileSource")
    def file_source(self) -> pulumi.Output[Optional[_builtins.str]]:
        """
        The source of the file to upload. For the current implementation, this is a reference field. In future versions, this may support URLs or local file paths for automatic upload. Examples: 'https://example.com/logo.png', '/path/to/local/file.png'.
        """
        return pulumi.get(self, "file_source")

    @_builtins.property
    @pulumi.getter(name="hostedUrl")
    def hosted_url(self) -> pulumi.Output[Optional[_builtins.str]]:
        """
        The Webflow CDN URL where the asset will be hosted (read-only). This URL becomes accessible after completing the S3 upload. Example: 'https://assets.website-files.com/.../logo.png'.
        """
        return pulumi.get(self, "hosted_url")

    @_builtins.property
    @pulumi.getter(name="lastUpdated")
    def last_updated(self) -> pulumi.Output[Optional[_builtins.str]]:
        """
        The timestamp when the asset was last modified (RFC3339 format, read-only). For most assets, this will be the same as createdOn since assets are immutable.
        """
        return pulumi.get(self, "last_updated")

    @_builtins.property
    @pulumi.getter(name="parentFolder")
    def parent_folder(self) -> pulumi.Output[Optional[_builtins.str]]:
        """
        Optional folder ID where the asset will be organized in the Webflow Assets panel. If not specified, the asset will be placed at the root level. Example: '5f0c8c9e1c9d440000e8d8c4'.
        """
        return pulumi.get(self, "parent_folder")

    @_builtins.property
    @pulumi.getter(name="siteId")
    def site_id(self) -> pulumi.Output[_builtins.str]:
        """
        The Webflow site ID (24-character lowercase hexadecimal string, e.g., '5f0c8c9e1c9d440000e8d8c3'). You can find your site ID in the Webflow dashboard under Site Settings. This field will be validated before making any API calls.
        """
        return pulumi.get(self, "site_id")

    @_builtins.property
    @pulumi.getter
    def size(self) -> pulumi.Output[Optional[_builtins.int]]:
        """
        The size of the asset in bytes (read-only). This is the actual size of the uploaded file.
        """
        return pulumi.get(self, "size")

    @_builtins.property
    @pulumi.getter(name="uploadDetails")
    def upload_details(self) -> pulumi.Output[Optional[Mapping[str, _builtins.str]]]:
        """
        AWS S3 POST form fields required to complete the upload (read-only). Include these as form fields when POSTing the file to uploadUrl. Keys: acl, bucket, key, Content-Type, X-Amz-Algorithm, X-Amz-Credential, X-Amz-Date, Policy, X-Amz-Signature, success_action_status, Cache-Control.
        """
        return pulumi.get(self, "upload_details")

    @_builtins.property
    @pulumi.getter(name="uploadUrl")
    def upload_url(self) -> pulumi.Output[Optional[_builtins.str]]:
        """
        The presigned S3 URL for uploading the file content (read-only). Use this URL along with uploadDetails to complete the asset upload. See AWS S3 POST documentation: https://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectPOST.html
        """
        return pulumi.get(self, "upload_url")

