# 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 ModflowGwemwe(MFPackage):
    """
    ModflowGwemwe defines a MWE 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.
    flow_package_name : string
        keyword to specify the name of the corresponding flow package.  if not
        specified, then the corresponding flow package must have the same name as this
        advanced transport package (the name associated with this package in the gwe
        name file).
    auxiliary : [string]
        defines an array of one or more auxiliary variable names.  there is no limit on
        the number of auxiliary variables that can be provided on this line; however,
        lists of information provided in subsequent blocks must have a column of data
        for each auxiliary variable name defined here.   the number of auxiliary
        variables detected on this line determines the value for naux.  comments cannot
        be provided anywhere on this line as they will be interpreted as auxiliary
        variable names.  auxiliary variables may not be used by the package, but they
        will be available for use by other parts of the program.  the program will
        terminate with an error if auxiliary variables are specified on more than one
        line in the options block.
    flow_package_auxiliary_name : string
        keyword to specify the name of an auxiliary variable in the corresponding flow
        package.  if specified, then the simulated temperatures from this advanced
        transport package will be copied into the auxiliary variable specified with
        this name.  note that the flow package must have an auxiliary variable with
        this name or the program will terminate with an error.  if the flows for this
        advanced transport package are read from a file, then this option will have no
        effect.
    boundnames : keyword
        keyword to indicate that boundary names may be provided with the list of well
        cells.
    print_input : keyword
        keyword to indicate that the list of well information will be written to the
        listing file immediately after it is read.
    print_temperature : keyword
        keyword to indicate that the list of well {#2} will be printed to the listing
        file for every stress period in which 'temperature print' is specified in
        output control.  if there is no output control option and print_{#3} is
        specified, then {#2} are printed for the last time step of each stress period.
    print_flows : keyword
        keyword to indicate that the list of well flow rates will be printed to the
        listing file for every stress period time step in which 'budget print' is
        specified in output control.  if there is no output control option and
        'print_flows' is specified, then flow rates are printed for the last time step
        of each stress period.
    save_flows : keyword
        keyword to indicate that well flow terms will be written to the file specified
        with 'budget fileout' in output control.
    temperature_filerecord : (tempfile)
        * tempfile : string
                name of the binary output file to write temperature information.

    budget_filerecord : (budgetfile)
        * budgetfile : string
                name of the binary output file to write budget information.

    budgetcsv_filerecord : (budgetcsvfile)
        * budgetcsvfile : string
                name of the comma-separated value (CSV) output file to write budget summary
                information.  A budget summary record will be written to this file for each
                time step of the simulation.

    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.
    observations : record obs6 filein obs6_filename
        Contains data for the obs package. Data can be passed as a dictionary to the
        obs package with variable names as keys and package data as values. Data for
        the observations variable is also acceptable. See obs package documentation for
        more information.
    packagedata : [(mawno, strt, ktf, fthk, aux, boundname)]
        * mawno : integer
                integer value that defines the well number associated with the specified PERIOD
                data on the line. MAWNO must be greater than zero and less than or equal to
                NMAWWELLS.
        * strt : double precision
                real value that defines the starting temperature for the well.
        * ktf : double precision
                is the thermal conductivity of the material between the aquifer cell and the
                feature. The thickness of the material is defined by the variable FTHK.
        * fthk : double precision
                real value that defines the thickness of the material through which conduction
                occurs.  Must be greater than 0.
        * aux : [double precision]
                represents the values of the auxiliary variables for each well. The values of
                auxiliary variables must be present for each well. The values must be specified
                in the order of the auxiliary variables specified in the OPTIONS block.  If the
                package supports time series and 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.
        * boundname : string
                name of the well cell.  BOUNDNAME is an ASCII character variable that can
                contain as many as 40 characters.  If BOUNDNAME contains spaces in it, then the
                entire name must be enclosed within single quotes.

    mweperioddata : [(mawno, mwesetting)]
        * mawno : integer
                integer value that defines the well number associated with the specified period
                data on the line. mawno must be greater than zero and less than or equal to
                nmawwells.
        * mwesetting : temperature | status | rate | auxiliaryrecord
                line of information that is parsed into a keyword and values.  keyword values
                that can be used to start the mwesetting string include: status, temperature,
                rainfall, evaporation, runoff, and auxiliary.  these settings are used to
                assign the temperature of associated with the corresponding flow terms.
                temperatures cannot be specified for all flow terms.  for example, the multi-
                aquifer well package supports a 'withdrawal' flow term.  if this withdrawal
                term is active, then water will be withdrawn from the well at the calculated
                temperature of the well.
                * temperature : string
                            real or character value that defines the temperature for the well. the
                            specified temperature is only applied if the well is a constant temperature
                            well. 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.
                * status : string
                            keyword option to define well status.  status can be active, inactive, or
                            constant. by default, status is active, which means that temperature will be
                            calculated for the well.  if a well is inactive, then there will be no solute
                            mass fluxes into or out of the well and the inactive value will be written for
                            the well temperature.  if a well is constant, then the temperature for the well
                            will be fixed at the user specified value.
                * rate : string
                            real or character value that defines the injection temperature
                            :math:`(e.g.,:^{circ}c:or:^{circ}f)` for the well. 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.
                * auxiliaryrecord : (auxiliary, auxname, auxval)
                            * auxiliary : keyword
                                            keyword for specifying auxiliary variable.
                            * auxname : string
                                            name for the auxiliary variable to be assigned AUXVAL.  AUXNAME must match one
                                            of the auxiliary variable names defined in the OPTIONS block. If AUXNAME does
                                            not match one of the auxiliary variable names defined in the OPTIONS block the
                                            data are ignored.
                            * auxval : double precision
                                            value for the auxiliary variable. 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.




    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`.

    """

    auxiliary = ArrayTemplateGenerator(("gwe6", "mwe", "options", "auxiliary"))
    temperature_filerecord = ListTemplateGenerator(
        ("gwe6", "mwe", "options", "temperature_filerecord")
    )
    budget_filerecord = ListTemplateGenerator(
        ("gwe6", "mwe", "options", "budget_filerecord")
    )
    budgetcsv_filerecord = ListTemplateGenerator(
        ("gwe6", "mwe", "options", "budgetcsv_filerecord")
    )
    ts_filerecord = ListTemplateGenerator(("gwe6", "mwe", "options", "ts_filerecord"))
    obs_filerecord = ListTemplateGenerator(("gwe6", "mwe", "options", "obs_filerecord"))
    packagedata = ListTemplateGenerator(("gwe6", "mwe", "packagedata", "packagedata"))
    mweperioddata = ListTemplateGenerator(("gwe6", "mwe", "period", "mweperioddata"))
    package_abbr = "gwemwe"
    _package_type = "mwe"
    dfn_file_name = "gwe-mwe.dfn"
    dfn = [
        ["header", "multi-package"],
        [
            "block options",
            "name flow_package_name",
            "type string",
            "shape",
            "reader urword",
            "optional true",
        ],
        [
            "block options",
            "name auxiliary",
            "type string",
            "shape (naux)",
            "reader urword",
            "optional true",
        ],
        [
            "block options",
            "name flow_package_auxiliary_name",
            "type string",
            "shape",
            "reader urword",
            "optional true",
        ],
        [
            "block options",
            "name boundnames",
            "type keyword",
            "shape",
            "reader urword",
            "optional true",
        ],
        [
            "block options",
            "name print_input",
            "type keyword",
            "reader urword",
            "optional true",
        ],
        [
            "block options",
            "name print_temperature",
            "type keyword",
            "reader urword",
            "optional true",
        ],
        [
            "block options",
            "name print_flows",
            "type keyword",
            "reader urword",
            "optional true",
        ],
        [
            "block options",
            "name save_flows",
            "type keyword",
            "reader urword",
            "optional true",
        ],
        [
            "block options",
            "name temperature_filerecord",
            "type record temperature fileout tempfile",
            "shape",
            "reader urword",
            "tagged true",
            "optional true",
        ],
        [
            "block options",
            "name temperature",
            "type keyword",
            "shape",
            "in_record true",
            "reader urword",
            "tagged true",
            "optional false",
        ],
        [
            "block options",
            "name tempfile",
            "type string",
            "preserve_case true",
            "shape",
            "in_record true",
            "reader urword",
            "tagged false",
            "optional false",
        ],
        [
            "block options",
            "name budget_filerecord",
            "type record budget fileout budgetfile",
            "shape",
            "reader urword",
            "tagged true",
            "optional true",
        ],
        [
            "block options",
            "name budget",
            "type keyword",
            "shape",
            "in_record true",
            "reader urword",
            "tagged true",
            "optional false",
        ],
        [
            "block options",
            "name fileout",
            "type keyword",
            "shape",
            "in_record true",
            "reader urword",
            "tagged true",
            "optional false",
        ],
        [
            "block options",
            "name budgetfile",
            "type string",
            "preserve_case true",
            "shape",
            "in_record true",
            "reader urword",
            "tagged false",
            "optional false",
        ],
        [
            "block options",
            "name budgetcsv_filerecord",
            "type record budgetcsv fileout budgetcsvfile",
            "shape",
            "reader urword",
            "tagged true",
            "optional true",
        ],
        [
            "block options",
            "name budgetcsv",
            "type keyword",
            "shape",
            "in_record true",
            "reader urword",
            "tagged true",
            "optional false",
        ],
        [
            "block options",
            "name budgetcsvfile",
            "type string",
            "preserve_case true",
            "shape",
            "in_record true",
            "reader urword",
            "tagged false",
            "optional false",
        ],
        [
            "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 options",
            "name obs_filerecord",
            "type record obs6 filein obs6_filename",
            "shape",
            "reader urword",
            "tagged true",
            "optional true",
            "construct_package obs",
            "construct_data observations",
            "parameter_name continuous",
        ],
        [
            "block options",
            "name obs6",
            "type keyword",
            "shape",
            "in_record true",
            "reader urword",
            "tagged true",
            "optional false",
        ],
        [
            "block options",
            "name obs6_filename",
            "type string",
            "preserve_case true",
            "in_record true",
            "tagged false",
            "reader urword",
            "optional false",
        ],
        [
            "block packagedata",
            "name packagedata",
            "type recarray mawno strt ktf fthk aux boundname",
            "shape (maxbound)",
            "reader urword",
        ],
        [
            "block packagedata",
            "name mawno",
            "type integer",
            "shape",
            "tagged false",
            "in_record true",
            "reader urword",
            "numeric_index true",
        ],
        [
            "block packagedata",
            "name strt",
            "type double precision",
            "shape",
            "tagged false",
            "in_record true",
            "reader urword",
        ],
        [
            "block packagedata",
            "name ktf",
            "type double precision",
            "shape",
            "tagged false",
            "in_record true",
            "reader urword",
        ],
        [
            "block packagedata",
            "name fthk",
            "type double precision",
            "shape",
            "tagged false",
            "in_record true",
            "reader urword",
        ],
        [
            "block packagedata",
            "name aux",
            "type double precision",
            "in_record true",
            "tagged false",
            "shape (naux)",
            "reader urword",
            "time_series true",
            "optional true",
        ],
        [
            "block packagedata",
            "name boundname",
            "type string",
            "shape",
            "tagged false",
            "in_record true",
            "reader urword",
            "optional true",
        ],
        [
            "block period",
            "name iper",
            "type integer",
            "block_variable true",
            "in_record true",
            "tagged false",
            "shape",
            "valid",
            "reader urword",
            "optional false",
        ],
        [
            "block period",
            "name mweperioddata",
            "type recarray mawno mwesetting",
            "shape",
            "reader urword",
        ],
        [
            "block period",
            "name mawno",
            "type integer",
            "shape",
            "tagged false",
            "in_record true",
            "reader urword",
            "numeric_index true",
        ],
        [
            "block period",
            "name mwesetting",
            "type keystring status temperature rate auxiliaryrecord",
            "shape",
            "tagged false",
            "in_record true",
            "reader urword",
        ],
        [
            "block period",
            "name status",
            "type string",
            "shape",
            "tagged true",
            "in_record true",
            "reader urword",
        ],
        [
            "block period",
            "name temperature",
            "type string",
            "shape",
            "tagged true",
            "in_record true",
            "time_series true",
            "reader urword",
        ],
        [
            "block period",
            "name rate",
            "type string",
            "shape",
            "tagged true",
            "in_record true",
            "reader urword",
            "time_series true",
        ],
        [
            "block period",
            "name auxiliaryrecord",
            "type record auxiliary auxname auxval",
            "shape",
            "tagged",
            "in_record true",
            "reader urword",
        ],
        [
            "block period",
            "name auxiliary",
            "type keyword",
            "shape",
            "in_record true",
            "reader urword",
        ],
        [
            "block period",
            "name auxname",
            "type string",
            "shape",
            "tagged false",
            "in_record true",
            "reader urword",
        ],
        [
            "block period",
            "name auxval",
            "type double precision",
            "shape",
            "tagged false",
            "in_record true",
            "reader urword",
            "time_series true",
        ],
    ]

    def __init__(
        self,
        model,
        loading_package=False,
        flow_package_name=None,
        auxiliary=None,
        flow_package_auxiliary_name=None,
        boundnames=None,
        print_input=None,
        print_temperature=None,
        print_flows=None,
        save_flows=None,
        temperature_filerecord=None,
        budget_filerecord=None,
        budgetcsv_filerecord=None,
        timeseries=None,
        observations=None,
        packagedata=None,
        mweperioddata=None,
        filename=None,
        pname=None,
        **kwargs,
    ):
        """Initialize ModflowGwemwe."""
        super().__init__(
            parent=model,
            package_type="mwe",
            filename=filename,
            pname=pname,
            loading_package=loading_package,
            **kwargs,
        )

        self.flow_package_name = self.build_mfdata(
            "flow_package_name", flow_package_name
        )
        self.auxiliary = self.build_mfdata("auxiliary", auxiliary)
        self.flow_package_auxiliary_name = self.build_mfdata(
            "flow_package_auxiliary_name", flow_package_auxiliary_name
        )
        self.boundnames = self.build_mfdata("boundnames", boundnames)
        self.print_input = self.build_mfdata("print_input", print_input)
        self.print_temperature = self.build_mfdata(
            "print_temperature", print_temperature
        )
        self.print_flows = self.build_mfdata("print_flows", print_flows)
        self.save_flows = self.build_mfdata("save_flows", save_flows)
        self.temperature_filerecord = self.build_mfdata(
            "temperature_filerecord", temperature_filerecord
        )
        self.budget_filerecord = self.build_mfdata(
            "budget_filerecord", budget_filerecord
        )
        self.budgetcsv_filerecord = self.build_mfdata(
            "budgetcsv_filerecord", budgetcsv_filerecord
        )
        self._ts_filerecord = self.build_mfdata("ts_filerecord", None)
        self._ts_package = self.build_child_package(
            "ts", timeseries, "timeseries", self._ts_filerecord
        )
        self._obs_filerecord = self.build_mfdata("obs_filerecord", None)
        self._obs_package = self.build_child_package(
            "obs", observations, "continuous", self._obs_filerecord
        )
        self.packagedata = self.build_mfdata("packagedata", packagedata)
        self.mweperioddata = self.build_mfdata("mweperioddata", mweperioddata)

        self._init_complete = True
