import { Injectable } from '@angular/core';

@Injectable({
  providedIn: 'root'
})
export class AlbumService {
  private albumPhotos = [
    {
      imageUrl: 'assets/image/dt1.jpg'
    },
    {
      imageUrl: 'assets/image/dt5.jpg'
    },
    {
      imageUrl: 'assets/image/dt3.jpg'
    },
    {
        imageUrl: 'assets/image/dt4.jpg'
      },
      {
        imageUrl: 'assets/image/dt2.jpg'
      }
  ];

  constructor() {}

  getAlbumPhotos() {
    return this.albumPhotos;
  }

  addPhoto(newPhoto: { imageUrl: string; }) {
    const randomIndex = Math.floor(Math.random() * this.albumPhotos.length); // 随机选择一个索引
    const randomPhoto = this.albumPhotos[randomIndex];
    this.albumPhotos.push(randomPhoto); // 将随机选择的图片添加到相册中
  }
}