version: "1"

container:
  config:
    provider: Configuration

  database_client:
    provider: Singleton
    provides: sqlite3.connect
    args:
      - container.config.database.dsn

  s3_client:
    provider: Singleton
    provides: boto3.client
    kwargs:
      service_name: s3
      aws_access_key_id: container.config.aws.access_key_id
      aws_secret_access_key: container.config.aws.secret_access_key

  user_service:
    provider: Factory
    provides: schemasample.services.UserService
    kwargs:
      db: container.database_client

  auth_service:
    provider: Factory
    provides: schemasample.services.AuthService
    kwargs:
      db: container.database_client
      token_ttl: container.config.auth.token_ttl.as_int()

  photo_service:
    provider: Factory
    provides: schemasample.services.PhotoService
    kwargs:
      db: container.database_client
      s3: container.s3_client
