#!/usr/bin/env python

import argparse

import everest


def _build_argument_parser() -> argparse.ArgumentParser:
    description = (
        "Sets ENTRY in WELL_DATA. ENTRY is expected to be a dictionary mapping a "
        "single key to a list of the same lenght as WELL_DATA. In the resulting "
        "well data each entry maps the specified key to the value in ENTRY of "
        "corresponding index. This operation is similar to wdupdate, but is based "
        'on order instead of the "name" key.'
    )
    parser = argparse.ArgumentParser(description=description)
    parser.add_argument(
        "--output",
        required=True,
        help="the well data will be output to this file as json",
    )
    parser.add_argument(
        "--well_data",
        required=True,
        help="the well data as json or yaml",
    )
    parser.add_argument(
        "--entry",
        required=True,
        help="an entry that is to be set in well_data as yaml or json",
    )
    return parser


def main():
    arg_parser = _build_argument_parser()
    args = arg_parser.parse_args()

    everest.jobs.well_tools.well_set(
        args.well_data,
        args.entry,
        args.output,
    )


if __name__ == "__main__":
    main()
