package test;

import dagger.internal.DaggerGenerated;
import dagger.internal.DoubleCheck;
import dagger.internal.Provider;
import dagger.internal.SingleCheck;
import javax.annotation.processing.Generated;

@DaggerGenerated
@Generated(
    value = "dagger.internal.codegen.ComponentProcessor",
    comments = "https://dagger.dev"
)
@SuppressWarnings({
    "unchecked",
    "rawtypes",
    "KotlinInternal",
    "KotlinInternalInJava",
    "cast",
    "deprecation",
    "nullness:initialization.field.uninitialized"
})
final class DaggerTestComponent {
  private DaggerTestComponent() {
  }

  public static Builder builder() {
    return new Builder();
  }

  public static TestComponent create() {
    return new Builder().build();
  }

  static final class Builder {
    private Builder() {
    }

    public TestComponent build() {
      return new TestComponentImpl();
    }
  }

  private static final class TestComponentImpl implements TestComponent {
    private final TestComponentImpl testComponentImpl = this;

    private Provider<RegularScoped> regularScopedProvider;

    private Provider<ReusableScoped> reusableScopedProvider;

    private TestComponentImpl() {

      initialize();

    }

    @SuppressWarnings("unchecked")
    private void initialize() {
      this.regularScopedProvider = DoubleCheck.provider(new SwitchingProvider<RegularScoped>(testComponentImpl, 0));
      this.reusableScopedProvider = SingleCheck.provider(new SwitchingProvider<ReusableScoped>(testComponentImpl, 1));
    }

    @Override
    public Object regular() {
      return regularScopedProvider.get();
    }

    @Override
    public Object reusable() {
      return reusableScopedProvider.get();
    }

    @Override
    public Object unscoped() {
      return new Unscoped();
    }

    private static final class SwitchingProvider<T> implements Provider<T> {
      private final TestComponentImpl testComponentImpl;

      private final int id;

      SwitchingProvider(TestComponentImpl testComponentImpl, int id) {
        this.testComponentImpl = testComponentImpl;
        this.id = id;
      }

      @SuppressWarnings("unchecked")
      @Override
      public T get() {
        switch (id) {
          case 0: // test.RegularScoped 
          return (T) new RegularScoped();

          case 1: // test.ReusableScoped 
          return (T) new ReusableScoped();

          default: throw new AssertionError(id);
        }
      }
    }
  }
}

