import Regulator
import ResistorVoltageDivider

module AdjustableRegulator from Regulator:
    """
    Adjustable regulator with resistor divider feedback compared to .
    """
    input_voltage: voltage
    """
    Voltage of power_in
    """
    output_voltage: voltage
    """
    Voltage of power_out
    """
    reference_voltage: voltage
    """
    Reference voltage of the regulator IC
    """
    feedback_divider = new ResistorVoltageDivider
    """
    Resistor divider from output voltage used as feedback signal to be compared against reference voltage

    To manage current draw of divider, constrain current or total_resistance
    """

    assert feedback_divider.v_in is output_voltage
    assert feedback_divider.v_out is reference_voltage
    assert feedback_divider.current within 1uA to 1mA  # TODO: remove default and make required
    assert input_voltage is power_in.voltage
    assert output_voltage is power_out.voltage

    power_out ~ feedback_divider.ref_in

    power_in.required = True
    power_out.required = True

module Buck from AdjustableRegulator:
    pass

module Boost from AdjustableRegulator:
    pass

module FixedLDO from Regulator:
    pass

module AdjustableLDO from AdjustableRegulator:
    pass

module Flyback from AdjustableRegulator:
    pass
