package com.ikon.projectmanagement.entity;

import jakarta.persistence.*;
import lombok.*;
import java.util.*;

import org.hibernate.annotations.JdbcTypeCode;
import org.hibernate.type.SqlTypes;

import com.ikon.projectmanagement.dto.response.ProductExpenseResponseDto;

@Entity
@Table(name = "product_project")
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class ProductOfProject {

    @Id
    @GeneratedValue
    @JdbcTypeCode(SqlTypes.UUID)
    @Column(name = "product_identifier")
    private UUID productIdentifier;

    @Column(name = "project_identifier", nullable = true)
    @JdbcTypeCode(SqlTypes.UUID)
    private UUID projectIdentifier;

    @Column(name = "project_name", nullable = true)
    private String projectName;

    @Column(name = "project_manager", nullable = true)
    @JdbcTypeCode(SqlTypes.UUID)
    private UUID projectManager;

    @Column(nullable = true)
    private UUID accountId;

    @Column(nullable = true)
    private UUID leadIdentifier;

    @Column(nullable = true)
    private String productStatus;

    @Column(nullable = true)
    private String updatedOn;

    @Column(nullable = true)
    private String projectStatus;

    @Column(nullable = true)
    private String productType;

    @Column(columnDefinition = "TEXT", nullable = true)
    private String productDescription;

    @Column(nullable = true)
    private Double discountPercent;

    @Column(nullable = true)
    private String createdOn;

    @Column(nullable = true)
    private UUID updatedBy;

    @Column(nullable = true)
    private UUID createdBy;

    @OneToMany(mappedBy = "productPS", cascade = CascadeType.ALL, orphanRemoval = true)
    private List<ProductPSQuotation> quotation = new ArrayList<>();

    @OneToMany(mappedBy = "productPS", cascade = CascadeType.ALL, orphanRemoval = true)
    private List<ProductPSResourceAllocation> resourceDataWithAllocation = new ArrayList<>();

    @OneToMany(mappedBy = "productPS", cascade = CascadeType.ALL, orphanRemoval = true)
    @MapKey(name = "id")
    private Map<UUID, ProductOfProjectExpenseDetail> expenseDetails = new HashMap<>();

}
