# 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
from . import outputs
from ._inputs import *

__all__ = ['PageCustomCodeArgs', 'PageCustomCode']

@pulumi.input_type
class PageCustomCodeArgs:
    def __init__(__self__, *,
                 page_id: pulumi.Input[_builtins.str],
                 scripts: pulumi.Input[Sequence[pulumi.Input['PageCustomCodeScriptArgs']]]):
        """
        The set of arguments for constructing a PageCustomCode resource.
        :param pulumi.Input[_builtins.str] page_id: The Webflow page ID (24-character hexadecimal string, e.g., '5f0c8c9e1c9d440000e8d8c4'). You can find page IDs using the Webflow Pages API or in the Webflow designer. This field will be validated before making any API calls.
        :param pulumi.Input[Sequence[pulumi.Input['PageCustomCodeScriptArgs']]] scripts: List of custom code scripts to apply to the page. Each script must reference a script ID and version that have been previously registered. All scripts in this list will be applied to the page; any scripts not listed will be removed from the page.
        """
        pulumi.set(__self__, "page_id", page_id)
        pulumi.set(__self__, "scripts", scripts)

    @_builtins.property
    @pulumi.getter(name="pageId")
    def page_id(self) -> pulumi.Input[_builtins.str]:
        """
        The Webflow page ID (24-character hexadecimal string, e.g., '5f0c8c9e1c9d440000e8d8c4'). You can find page IDs using the Webflow Pages API or in the Webflow designer. This field will be validated before making any API calls.
        """
        return pulumi.get(self, "page_id")

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

    @_builtins.property
    @pulumi.getter
    def scripts(self) -> pulumi.Input[Sequence[pulumi.Input['PageCustomCodeScriptArgs']]]:
        """
        List of custom code scripts to apply to the page. Each script must reference a script ID and version that have been previously registered. All scripts in this list will be applied to the page; any scripts not listed will be removed from the page.
        """
        return pulumi.get(self, "scripts")

    @scripts.setter
    def scripts(self, value: pulumi.Input[Sequence[pulumi.Input['PageCustomCodeScriptArgs']]]):
        pulumi.set(self, "scripts", value)


@pulumi.type_token("webflow:index:PageCustomCode")
class PageCustomCode(pulumi.CustomResource):
    @overload
    def __init__(__self__,
                 resource_name: str,
                 opts: Optional[pulumi.ResourceOptions] = None,
                 page_id: Optional[pulumi.Input[_builtins.str]] = None,
                 scripts: Optional[pulumi.Input[Sequence[pulumi.Input[Union['PageCustomCodeScriptArgs', 'PageCustomCodeScriptArgsDict']]]]] = None,
                 __props__=None):
        """
        Manages custom code (JavaScript) scripts applied to a Webflow page. This resource allows you to apply registered custom code scripts to specific pages. Scripts must first be registered using the RegisteredScript resource before they can be applied. All scripts in the configuration will be applied to the page; scripts not listed will be removed.

        :param str resource_name: The name of the resource.
        :param pulumi.ResourceOptions opts: Options for the resource.
        :param pulumi.Input[_builtins.str] page_id: The Webflow page ID (24-character hexadecimal string, e.g., '5f0c8c9e1c9d440000e8d8c4'). You can find page IDs using the Webflow Pages API or in the Webflow designer. This field will be validated before making any API calls.
        :param pulumi.Input[Sequence[pulumi.Input[Union['PageCustomCodeScriptArgs', 'PageCustomCodeScriptArgsDict']]]] scripts: List of custom code scripts to apply to the page. Each script must reference a script ID and version that have been previously registered. All scripts in this list will be applied to the page; any scripts not listed will be removed from the page.
        """
        ...
    @overload
    def __init__(__self__,
                 resource_name: str,
                 args: PageCustomCodeArgs,
                 opts: Optional[pulumi.ResourceOptions] = None):
        """
        Manages custom code (JavaScript) scripts applied to a Webflow page. This resource allows you to apply registered custom code scripts to specific pages. Scripts must first be registered using the RegisteredScript resource before they can be applied. All scripts in the configuration will be applied to the page; scripts not listed will be removed.

        :param str resource_name: The name of the resource.
        :param PageCustomCodeArgs 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(PageCustomCodeArgs, 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,
                 page_id: Optional[pulumi.Input[_builtins.str]] = None,
                 scripts: Optional[pulumi.Input[Sequence[pulumi.Input[Union['PageCustomCodeScriptArgs', 'PageCustomCodeScriptArgsDict']]]]] = 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__ = PageCustomCodeArgs.__new__(PageCustomCodeArgs)

            if page_id is None and not opts.urn:
                raise TypeError("Missing required property 'page_id'")
            __props__.__dict__["page_id"] = page_id
            if scripts is None and not opts.urn:
                raise TypeError("Missing required property 'scripts'")
            __props__.__dict__["scripts"] = scripts
            __props__.__dict__["created_on"] = None
            __props__.__dict__["last_updated"] = None
        super(PageCustomCode, __self__).__init__(
            'webflow:index:PageCustomCode',
            resource_name,
            __props__,
            opts)

    @staticmethod
    def get(resource_name: str,
            id: pulumi.Input[str],
            opts: Optional[pulumi.ResourceOptions] = None) -> 'PageCustomCode':
        """
        Get an existing PageCustomCode 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__ = PageCustomCodeArgs.__new__(PageCustomCodeArgs)

        __props__.__dict__["created_on"] = None
        __props__.__dict__["last_updated"] = None
        __props__.__dict__["page_id"] = None
        __props__.__dict__["scripts"] = None
        return PageCustomCode(resource_name, opts=opts, __props__=__props__)

    @_builtins.property
    @pulumi.getter(name="createdOn")
    def created_on(self) -> pulumi.Output[Optional[_builtins.str]]:
        """
        The timestamp when the page custom code was first created (RFC3339 format). This is automatically set when the configuration is first created and is read-only.
        """
        return pulumi.get(self, "created_on")

    @_builtins.property
    @pulumi.getter(name="lastUpdated")
    def last_updated(self) -> pulumi.Output[Optional[_builtins.str]]:
        """
        The timestamp when the page custom code was last updated (RFC3339 format). This is automatically set when the configuration is updated and is read-only.
        """
        return pulumi.get(self, "last_updated")

    @_builtins.property
    @pulumi.getter(name="pageId")
    def page_id(self) -> pulumi.Output[_builtins.str]:
        """
        The Webflow page ID (24-character hexadecimal string, e.g., '5f0c8c9e1c9d440000e8d8c4'). You can find page IDs using the Webflow Pages API or in the Webflow designer. This field will be validated before making any API calls.
        """
        return pulumi.get(self, "page_id")

    @_builtins.property
    @pulumi.getter
    def scripts(self) -> pulumi.Output[Sequence['outputs.PageCustomCodeScript']]:
        """
        List of custom code scripts to apply to the page. Each script must reference a script ID and version that have been previously registered. All scripts in this list will be applied to the page; any scripts not listed will be removed from the page.
        """
        return pulumi.get(self, "scripts")

