package com.ruoyi.web.modules.farming;

import java.util.Calendar;
import java.util.Date;
import com.ruoyi.web.modules.diagnosis.domain.BizServiceAppointment;
import com.ruoyi.web.modules.diagnosis.support.ServiceAppointmentRules;
import com.ruoyi.web.modules.farming.domain.BizServiceAppointmentReview;
import com.ruoyi.web.modules.farming.domain.BizTechResource;
import com.ruoyi.web.modules.farming.support.TechResourceRules;

/**
 * 我的预约（专家）测试样本。
 */
public final class ExpertMyAppointmentTestSamples
{
    public static final Long EXPERT_PROVIDER_ID = 401L;

    public static final Long SYS_USER_ID = 3L;

    public static final Long OTHER_PROVIDER_ID = 402L;

    private ExpertMyAppointmentTestSamples()
    {
    }

    public static BizTechResource boundExpertResource()
    {
        BizTechResource row = TechResourceTestSamples.sampleExpertDraft();
        row.setId(EXPERT_PROVIDER_ID);
        row.setSysUserId(SYS_USER_ID);
        row.setAccountAssigned(TechResourceRules.ACCOUNT_ASSIGNED_YES);
        return row;
    }

    public static BizServiceAppointment pendingAppointment()
    {
        BizServiceAppointment row = baseAppointment();
        row.setId(3000L);
        row.setStatus(ServiceAppointmentRules.STATUS_PENDING);
        return row;
    }

    public static BizServiceAppointment confirmedAppointment()
    {
        BizServiceAppointment row = baseAppointment();
        row.setId(3001L);
        row.setStatus(ServiceAppointmentRules.STATUS_CONFIRMED);
        return row;
    }

    public static BizServiceAppointment cancelledAppointment()
    {
        BizServiceAppointment row = baseAppointment();
        row.setId(3002L);
        row.setStatus(ServiceAppointmentRules.STATUS_CANCELLED);
        return row;
    }

    public static BizServiceAppointment rejectedAppointment()
    {
        BizServiceAppointment row = baseAppointment();
        row.setId(3003L);
        row.setStatus(ServiceAppointmentRules.STATUS_REJECTED);
        row.setRejectReason("时段冲突");
        return row;
    }

    public static BizServiceAppointment completedAppointment()
    {
        BizServiceAppointment row = baseAppointment();
        row.setId(3004L);
        row.setStatus(ServiceAppointmentRules.STATUS_COMPLETED);
        return row;
    }

    public static BizServiceAppointmentReview sampleReview()
    {
        BizServiceAppointmentReview review = new BizServiceAppointmentReview();
        review.setId(1L);
        review.setAppointmentId(3004L);
        review.setReviewerName("才让");
        review.setReviewTime(new Date());
        review.setPunctualityScore(5);
        review.setAttitudeScore(5);
        review.setGuidanceScore(4);
        review.setSummary("指导专业有效");
        return review;
    }

    private static BizServiceAppointment baseAppointment()
    {
        BizServiceAppointment row = new BizServiceAppointment();
        row.setProviderType(ServiceAppointmentRules.PROVIDER_TYPE_EXPERT);
        row.setProviderId(EXPERT_PROVIDER_ID);
        row.setAppointeeName("才让");
        row.setAppointDate(today());
        row.setTimeStart("14:00");
        row.setTimeEnd("15:00");
        row.setContactPhone("13900139001");
        row.setServiceAddress("巴青县某某镇");
        row.setServiceRequirement("专家上门指导");
        return row;
    }

    private static Date today()
    {
        Calendar cal = Calendar.getInstance();
        cal.set(Calendar.HOUR_OF_DAY, 0);
        cal.set(Calendar.MINUTE, 0);
        cal.set(Calendar.SECOND, 0);
        cal.set(Calendar.MILLISECOND, 0);
        return cal.getTime();
    }
}
