#!/usr/bin/env python

import argparse

import everest


def _build_argument_parser() -> argparse.ArgumentParser:
    description = (
        'Removes all entires of WELL_DATA which "name" is not listed in FILTER.'
    )
    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(
        "--filter",
        required=True,
        help="the well filter, a list containing the wells to keep, as yaml or json",
    )
    return parser


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

    everest.jobs.well_tools.well_filter(
        args.well_data,
        args.filter,
        args.output,
    )


if __name__ == "__main__":
    main()
