mutable struct DynamicGenerator{
    M <: Machine,
    S <: Shaft,
    A <: AVR,
    TG <: TurbineGov,
    P <: PSS,
} <: DynamicInjection
    static_injector::Union{Nothing, Generator}
    ω_ref::Float64
    machine::M
    shaft::S
    avr::A
    prime_mover::TG
    pss::P
    n_states::Int64
    states::Vector{Symbol}
    ext::Dict{String, Any}
    internal::InfrastructureSystemsInternal
end

function DynamicGenerator(
    static_injector::Generator,
    ω_ref::Float64,
    machine::M,
    shaft::S,
    avr::A,
    prime_mover::TG,
    pss::P,
    ext::Dict{String, Any} = Dict{String, Any}(),
) where {M <: Machine, S <: Shaft, A <: AVR, TG <: TurbineGov, P <: PSS}

    n_states = (
        machine.n_states +
        shaft.n_states +
        avr.n_states +
        prime_mover.n_states +
        pss.n_states
    )
    states = vcat(machine.states, shaft.states, avr.states, prime_mover.states, pss.states)

    return DynamicGenerator{M, S, A, TG, P}(
        static_injector,
        ω_ref,
        machine,
        shaft,
        avr,
        prime_mover,
        pss,
        n_states,
        states,
        ext,
        InfrastructureSystemsInternal(),
    )
end

function DynamicGenerator(;
    static_injector::Generator,
    ω_ref::Float64,
    machine::M,
    shaft::S,
    avr::A,
    prime_mover::TG,
    pss::P,
    ext::Dict{String, Any} = Dict{String, Any}(),
) where {M <: Machine, S <: Shaft, A <: AVR, TG <: TurbineGov, P <: PSS}
    DynamicGenerator(static_injector, ω_ref, machine, shaft, avr, prime_mover, pss, ext)
end

IS.get_name(device::DynamicGenerator) = get_name(device.static_injector)
get_bus(device::DynamicGenerator) = get_bus(device.static_injector)
get_Sbase(device::DynamicGenerator) = device.machine.s_rated
get_states(device::DynamicGenerator) = device.states
get_n_states(device::DynamicGenerator) = device.n_states
get_ω_ref(device::DynamicGenerator) = device.ω_ref
get_V_ref(device::DynamicGenerator) = get_voltage(get_bus(device))
get_P_ref(device::DynamicGenerator) = get_activepower(device.static_injector)
get_Q_ref(device::DynamicGenerator) = get_reactivepower(device.static_injector)
get_basepower(device::DynamicGenerator) = get_basepower(device.static_injector)
get_machine(device::DynamicGenerator) = device.machine
get_shaft(device::DynamicGenerator) = device.shaft
get_avr(device::DynamicGenerator) = device.avr
get_prime_mover(device::DynamicGenerator) = device.prime_mover
get_pss(device::DynamicGenerator) = device.pss
get_static_injector(device::DynamicGenerator) = device.static_injector
get_ext(device::DynamicGenerator) = device.ext
