# autogenerated file, do not modify

from os import PathLike, curdir
from typing import Union

from flopy.mf6.data.mfdatautil import ArrayTemplateGenerator, ListTemplateGenerator
from flopy.mf6.mfpackage import MFChildPackages, MFPackage


class ModflowUtlspc(MFPackage):
    """
    ModflowUtlspc defines a SPC package.

    Parameters
    ----------
    model
        Model that this package is a part of. Package is automatically
        added to model when it is initialized.
    loading_package : bool, default False
        Do not set this parameter. It is intended for debugging and internal
        processing purposes only.
    print_input : keyword
        keyword to indicate that the list of spc information will be written to the
        listing file immediately after it is read.
    timeseries : record ts6 filein ts6_filename
        Contains data for the ts package. Data can be passed as a dictionary to the ts
        package with variable names as keys and package data as values. Data for the
        timeseries variable is also acceptable. See ts package documentation for more
        information.
    maxbound : integer
        integer value specifying the maximum number of spc cells that will be specified
        for use during any stress period.
    perioddata : [(bndno, spcsetting)]
        * bndno : integer
                integer value that defines the boundary package feature number associated with
                the specified period data on the line. bndno must be greater than zero and less
                than or equal to maxbound.
        * spcsetting : concentration | temperature
                line of information that is parsed into a keyword and values.  keyword values
                that can be used to start the spcsetting string include: concentration and
                temperature.
                * concentration : double precision
                            is the boundary concentration. if the options block includes a timeseriesfile
                            entry (see the 'time-variable input' section), values can be obtained from a
                            time series by entering the time-series name in place of a numeric value. by
                            default, the concentration for each boundary feature is zero.
                * temperature : double precision
                            is the user-supplied boundary temperature. if the options block includes a
                            timeseriesfile entry (see the 'time-variable input' section), values can be
                            obtained from a time series by entering the time-series name in place of a
                            numeric value. by default, the temperature for each boundary feature is zero.



    filename : str or PathLike, optional
        Name or path of file where this package is stored.
    pname : str, optional
        Package name.
    **kwargs
        Extra keywords for :class:`flopy.mf6.mfpackage.MFPackage`.

    """

    ts_filerecord = ListTemplateGenerator(("spc", "options", "ts_filerecord"))
    perioddata = ListTemplateGenerator(("spc", "period", "perioddata"))
    package_abbr = "utlspc"
    _package_type = "spc"
    dfn_file_name = "utl-spc.dfn"
    dfn = [
        ["header", "multi-package"],
        [
            "block options",
            "name print_input",
            "type keyword",
            "reader urword",
            "optional true",
        ],
        [
            "block options",
            "name ts_filerecord",
            "type record ts6 filein ts6_filename",
            "shape",
            "reader urword",
            "tagged true",
            "optional true",
            "construct_package ts",
            "construct_data timeseries",
            "parameter_name timeseries",
        ],
        [
            "block options",
            "name ts6",
            "type keyword",
            "shape",
            "in_record true",
            "reader urword",
            "tagged true",
            "optional false",
        ],
        [
            "block options",
            "name filein",
            "type keyword",
            "shape",
            "in_record true",
            "reader urword",
            "tagged true",
            "optional false",
        ],
        [
            "block options",
            "name ts6_filename",
            "type string",
            "preserve_case true",
            "in_record true",
            "reader urword",
            "optional false",
            "tagged false",
        ],
        [
            "block dimensions",
            "name maxbound",
            "type integer",
            "reader urword",
            "optional false",
        ],
        [
            "block period",
            "name iper",
            "type integer",
            "block_variable true",
            "in_record true",
            "tagged false",
            "shape",
            "valid",
            "reader urword",
            "optional false",
        ],
        [
            "block period",
            "name perioddata",
            "type recarray bndno spcsetting",
            "shape",
            "reader urword",
        ],
        [
            "block period",
            "name bndno",
            "type integer",
            "shape",
            "tagged false",
            "in_record true",
            "reader urword",
            "numeric_index true",
        ],
        [
            "block period",
            "name spcsetting",
            "type keystring concentration temperature",
            "shape",
            "tagged false",
            "in_record true",
            "reader urword",
        ],
        [
            "block period",
            "name concentration",
            "type double precision",
            "shape",
            "tagged true",
            "in_record true",
            "reader urword",
            "time_series true",
        ],
        [
            "block period",
            "name temperature",
            "type double precision",
            "shape",
            "tagged true",
            "in_record true",
            "reader urword",
            "time_series true",
        ],
    ]

    def __init__(
        self,
        model,
        loading_package=False,
        print_input=None,
        timeseries=None,
        maxbound=None,
        perioddata=None,
        filename=None,
        pname=None,
        **kwargs,
    ):
        """Initialize ModflowUtlspc."""
        super().__init__(
            parent=model,
            package_type="spc",
            filename=filename,
            pname=pname,
            loading_package=loading_package,
            **kwargs,
        )

        self.print_input = self.build_mfdata("print_input", print_input)
        self._ts_filerecord = self.build_mfdata("ts_filerecord", None)
        self._ts_package = self.build_child_package(
            "ts", timeseries, "timeseries", self._ts_filerecord
        )
        self.maxbound = self.build_mfdata("maxbound", maxbound)
        self.perioddata = self.build_mfdata("perioddata", perioddata)

        self._init_complete = True
