package com.writeoff.module.project.model;

import java.time.LocalDate;
import java.time.LocalDateTime;

public class Project {
    /** 项目ID */
    private Long id;
    /** 项目名称 */
    private String name;
    /** 子项目名称（可为空） */
    private String subProjectName;
    /** 上级项目ID（为空表示一级项目） */
    private Long parentProjectId;
    /** 子项目数量 */
    private Integer subProjectCount;
    /** 项目开始日期 */
    private LocalDate startDate;
    /** 项目结束日期 */
    private LocalDate endDate;
    /** 兼容历史字段：合作企业ID */
    private Long enterpriseId;
    /** 兼容历史字段：合作企业名称 */
    private String enterpriseName;
    /** 主办单位ID */
    private Long hostEnterpriseId;
    /** 主办单位名称（当前租户） */
    private String hostEnterpriseName;
    /** 合作企业ID */
    private Long partnerEnterpriseId;
    /** 主办单位负责人用户ID */
    private Long hostOwnerUserId;
    /** 主办单位项目执行人用户ID */
    private Long hostExecutorUserId;
    /** 合作企业负责人用户ID */
    private Long partnerOwnerUserId;
    /** 合作企业项目执行人用户ID */
    private Long partnerExecutorUserId;
    /** 项目总预算（分） */
    private long budgetCent;
    /** 项目会议总期数 */
    private int meetingTotal;
    /** 已完成核销会议数量 */
    private int meetingCompletedCount;
    /** 是否允许单场超支 */
    private boolean allowMeetingOverBudget;
    /** 超支阈值比例（0.1=10%） */
    private double overBudgetThresholdRatio;
    /** 超支审批链（JSON） */
    private String overBudgetApprovalChainJson;
    /** 预算执行率 */
    private double budgetExecutionRatio;
    /** 风险标记（JSON） */
    private String riskFlagsJson;

    /** 核销进度-未开始场次 */
    private int writeOffNotStartedCount;
    /** 核销进度-核销中场次 */
    private int writeOffInProgressCount;
    /** 核销进度-核销完成场次 */
    private int writeOffCompletedCount;
    /** 劳务费用占比 */
    private double laborFeeRatio;
    /** 是否允许超过项目总费用 */
    private boolean allowProjectOverBudget;
    /** 发票信息快照（便于一键复制） */
    private String invoiceInfo;
    /** 费用占比（JSON） */
    private String expenseRatioJson;
    /** 项目费用设置（JSON） */
    private String projectFeeJson;
    /** 主办单位备份执行人用户ID */
    private Long hostBackupExecutorUserId;
    /** 合作企业备份执行人用户ID */
    private Long partnerBackupExecutorUserId;
    /** 项目负责人审批人用户ID */
    private Long projectOwnerApproverUserId;
    /** 财务审批人用户ID */
    private Long financeApproverUserId;
    /** 项目中止原因 */
    private String terminatedReason;
    /** 项目冻结原因 */
    private String freezeReason;
    /** 归档时间 */
    private LocalDateTime archivedAt;
    /** 关键变更日志（JSON） */
    private String keyChangeLogJson;
    /** 项目状态 */
    private ProjectStatus status;
    /** 主办单位负责人（TENANT_ADMIN） */
    private String hostOwnerUsers;
    /** 主办单位项目执行人（PROJECT_OWNER） */
    private String hostExecutorUsers;
    /** 合作企业负责人（PROJECT_EXECUTOR） */
    private String partnerOwnerUsers;
    /** 合作企业项目执行人（EXECUTOR） */
    private String partnerExecutorUsers;
    /** 是否已软删除 */
    private boolean deleted;

    public Project(Long id, String name, Long enterpriseId, long budgetCent, int meetingTotal, ProjectStatus status) {
        this(
                id, name, null, null, null, enterpriseId, null, null, enterpriseId, null, null, null, null,
                budgetCent, meetingTotal, 0, false, 0.1d, null, 0d, null,
                meetingTotal, 0, 0,
                0d, false, null, null, null, null, null, null, null, null, null, null, status
        );
    }

    public Project(Long id, String name, Long enterpriseId, String enterpriseName, long budgetCent, int meetingTotal, ProjectStatus status) {
        this(
                id, name, null, null, null, enterpriseId, enterpriseName, null, enterpriseId, null, null, null, null,
                budgetCent, meetingTotal, 0, false, 0.1d, null, 0d, null,
                meetingTotal, 0, 0,
                0d, false, null, null, null, null, null, null, null, null, null, null, status
        );
    }

    public Project(Long id,
                   String name,
                   String subProjectName,
                   LocalDate startDate,
                   LocalDate endDate,
                   Long enterpriseId,
                   String enterpriseName,
                   Long hostEnterpriseId,
                   Long partnerEnterpriseId,
                   Long hostOwnerUserId,
                   Long hostExecutorUserId,
                   Long partnerOwnerUserId,
                   Long partnerExecutorUserId,
                   long budgetCent,
                   int meetingTotal,
                   int meetingCompletedCount,
                   boolean allowMeetingOverBudget,
                   double overBudgetThresholdRatio,
                   String overBudgetApprovalChainJson,
                   double budgetExecutionRatio,
                   String riskFlagsJson,

                   int writeOffNotStartedCount,
                   int writeOffInProgressCount,
                   int writeOffCompletedCount,
                   double laborFeeRatio,
                   boolean allowProjectOverBudget,
                   String invoiceInfo,
                   String expenseRatioJson,
                   Long hostBackupExecutorUserId,
                   Long partnerBackupExecutorUserId,
                   Long projectOwnerApproverUserId,
                   Long financeApproverUserId,
                   String terminatedReason,
                   String freezeReason,
                   LocalDateTime archivedAt,
                   String keyChangeLogJson,
                   ProjectStatus status) {
        this.id = id;
        this.name = name;
        this.subProjectName = subProjectName;
        this.startDate = startDate;
        this.endDate = endDate;
        this.enterpriseId = enterpriseId;
        this.enterpriseName = enterpriseName;
        this.hostEnterpriseId = hostEnterpriseId;
        this.partnerEnterpriseId = partnerEnterpriseId;
        this.hostOwnerUserId = hostOwnerUserId;
        this.hostExecutorUserId = hostExecutorUserId;
        this.partnerOwnerUserId = partnerOwnerUserId;
        this.partnerExecutorUserId = partnerExecutorUserId;
        this.budgetCent = budgetCent;
        this.meetingTotal = meetingTotal;
        this.meetingCompletedCount = meetingCompletedCount;
        this.allowMeetingOverBudget = allowMeetingOverBudget;
        this.overBudgetThresholdRatio = overBudgetThresholdRatio;
        this.overBudgetApprovalChainJson = overBudgetApprovalChainJson;
        this.budgetExecutionRatio = budgetExecutionRatio;
        this.riskFlagsJson = riskFlagsJson;

        this.writeOffNotStartedCount = writeOffNotStartedCount;
        this.writeOffInProgressCount = writeOffInProgressCount;
        this.writeOffCompletedCount = writeOffCompletedCount;
        this.laborFeeRatio = laborFeeRatio;
        this.allowProjectOverBudget = allowProjectOverBudget;
        this.invoiceInfo = invoiceInfo;
        this.expenseRatioJson = expenseRatioJson;
        this.hostBackupExecutorUserId = hostBackupExecutorUserId;
        this.partnerBackupExecutorUserId = partnerBackupExecutorUserId;
        this.projectOwnerApproverUserId = projectOwnerApproverUserId;
        this.financeApproverUserId = financeApproverUserId;
        this.terminatedReason = terminatedReason;
        this.freezeReason = freezeReason;
        this.archivedAt = archivedAt;
        this.keyChangeLogJson = keyChangeLogJson;
        this.status = status;
    }

    public Long getId() {
        return id;
    }

    public String getName() {
        return name;
    }

    public String getSubProjectName() {
        return subProjectName;
    }

    public Integer getSubProjectCount() {
        return subProjectCount;
    }

    public Long getParentProjectId() {
        return parentProjectId;
    }

    public LocalDate getStartDate() {
        return startDate;
    }

    public LocalDate getEndDate() {
        return endDate;
    }

    public Long getEnterpriseId() {
        return enterpriseId;
    }

    public String getEnterpriseName() {
        return enterpriseName;
    }

    public Long getHostEnterpriseId() {
        return hostEnterpriseId;
    }

    public String getHostEnterpriseName() {
        return hostEnterpriseName;
    }

    public Long getPartnerEnterpriseId() {
        return partnerEnterpriseId;
    }

    public Long getHostOwnerUserId() {
        return hostOwnerUserId;
    }

    public Long getHostExecutorUserId() {
        return hostExecutorUserId;
    }

    public Long getPartnerOwnerUserId() {
        return partnerOwnerUserId;
    }

    public Long getPartnerExecutorUserId() {
        return partnerExecutorUserId;
    }

    public long getBudgetCent() {
        return budgetCent;
    }

    public int getMeetingTotal() {
        return meetingTotal;
    }

    public int getMeetingCompletedCount() {
        return meetingCompletedCount;
    }

    public boolean isAllowMeetingOverBudget() {
        return allowMeetingOverBudget;
    }

    public double getOverBudgetThresholdRatio() {
        return overBudgetThresholdRatio;
    }

    public String getOverBudgetApprovalChainJson() {
        return overBudgetApprovalChainJson;
    }

    public double getBudgetExecutionRatio() {
        return budgetExecutionRatio;
    }

    public String getRiskFlagsJson() {
        return riskFlagsJson;
    }



    public int getWriteOffNotStartedCount() {
        return writeOffNotStartedCount;
    }

    public int getWriteOffInProgressCount() {
        return writeOffInProgressCount;
    }

    public int getWriteOffCompletedCount() {
        return writeOffCompletedCount;
    }

    public double getLaborFeeRatio() {
        return laborFeeRatio;
    }

    public boolean isAllowProjectOverBudget() {
        return allowProjectOverBudget;
    }

    public String getInvoiceInfo() {
        return invoiceInfo;
    }

    public String getExpenseRatioJson() {
        return expenseRatioJson;
    }

    public String getProjectFeeJson() {
        return projectFeeJson;
    }

    public Long getHostBackupExecutorUserId() {
        return hostBackupExecutorUserId;
    }

    public Long getPartnerBackupExecutorUserId() {
        return partnerBackupExecutorUserId;
    }

    public Long getProjectOwnerApproverUserId() {
        return projectOwnerApproverUserId;
    }

    public Long getFinanceApproverUserId() {
        return financeApproverUserId;
    }

    public String getTerminatedReason() {
        return terminatedReason;
    }

    public String getFreezeReason() {
        return freezeReason;
    }

    public LocalDateTime getArchivedAt() {
        return archivedAt;
    }

    public String getKeyChangeLogJson() {
        return keyChangeLogJson;
    }

    public ProjectStatus getStatus() {
        return status;
    }

    public String getHostOwnerUsers() {
        return hostOwnerUsers;
    }

    public String getHostExecutorUsers() {
        return hostExecutorUsers;
    }

    public String getPartnerOwnerUsers() {
        return partnerOwnerUsers;
    }

    public String getPartnerExecutorUsers() {
        return partnerExecutorUsers;
    }

    public void setStatus(ProjectStatus status) {
        this.status = status;
    }

    public void setFreezeReason(String freezeReason) {
        this.freezeReason = freezeReason;
    }

    public void setTerminatedReason(String terminatedReason) {
        this.terminatedReason = terminatedReason;
    }

    public void setArchivedAt(LocalDateTime archivedAt) {
        this.archivedAt = archivedAt;
    }

    public void setSubProjectCount(Integer subProjectCount) {
        this.subProjectCount = subProjectCount;
    }

    public void setParentProjectId(Long parentProjectId) {
        this.parentProjectId = parentProjectId;
    }

    public void setHostEnterpriseName(String hostEnterpriseName) {
        this.hostEnterpriseName = hostEnterpriseName;
    }

    public void setHostOwnerUsers(String hostOwnerUsers) {
        this.hostOwnerUsers = hostOwnerUsers;
    }

    public void setHostExecutorUsers(String hostExecutorUsers) {
        this.hostExecutorUsers = hostExecutorUsers;
    }

    public void setPartnerOwnerUsers(String partnerOwnerUsers) {
        this.partnerOwnerUsers = partnerOwnerUsers;
    }

    public void setPartnerExecutorUsers(String partnerExecutorUsers) {
        this.partnerExecutorUsers = partnerExecutorUsers;
    }

    public void setProjectFeeJson(String projectFeeJson) {
        this.projectFeeJson = projectFeeJson;
    }

    public boolean isDeleted() {
        return deleted;
    }

    public void setDeleted(boolean deleted) {
        this.deleted = deleted;
    }
}
