package com.example.domain;

import java.io.Serializable;
import java.util.ArrayList;

import org.springframework.context.annotation.Scope;
import org.springframework.context.annotation.ScopedProxyMode;
import org.springframework.stereotype.Component;

import com.example.service.ShoesService;

import lombok.Getter;
import lombok.Setter;

@Component
@Scope(value= "session", proxyMode = ScopedProxyMode.TARGET_CLASS)
@Getter
@Setter
public class Cart implements Serializable{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	private Integer shoesId;
	private String photo;
	private String shoesName;
	private Integer shoesSize;
	private Integer quantity;
	private Integer price;
	private Integer productStatus;
	
	
	public void setCart(Integer shoesId, Integer quantity) {
		System.out.println(shoesId);
		Shoes shoes = new Shoes();
		ShoesService shoesService = new ShoesService();
		shoes = shoesService.findOne(shoesId);
		//System.out.println(shoes);
//		this.shoesId = shoesId;
//		this.photo = shoes.getPhoto();
//		this.shoesName = shoes.getName();
//		this.shoesSize = shoes.getSize();
//		this.quantity = quantity;
//		this.price = shoes.getPrice() * quantity;
//		System.out.print(this.price);
	}
	
	public ArrayList<Cart> getCart(){
		ArrayList<Cart> cartList = new ArrayList<Cart>();
		Cart data = new Cart();
		data.getShoesId();
		data.getPhoto();
		data.getShoesName();
		data.getShoesSize();
		data.getQuantity();
		data.getPrice();
		cartList.add(data);
		return cartList;
	}
}