package com.bcxin.tenant.open.domains.services.commands;

import com.bcxin.tenant.open.infrastructures.commands.CommandAbstract;
import com.bcxin.tenant.open.infrastructures.enums.PoliceEventCategory;
import com.bcxin.tenant.open.infrastructures.enums.PoliceEventLevel;
import com.bcxin.tenant.open.infrastructures.utils.StringUtil;
import lombok.Getter;

import java.sql.Date;
import java.sql.Timestamp;
import java.util.Map;

/**
 * 新增警情
 */
@Getter
public class CreatePoliceIncidentsCommand extends CommandAbstract {
    private final String name;
    private final String sceneUrl;
    private final String contact;
    private final PoliceEventLevel policeEventLevel;
    private final String address;
    private final String reason;
    private final String actionTaken;
    private final String actionTendency;
    private final int policeEventType;
    private final String description;

    private final PoliceEventCategory category;

    private final double latitude;

    private final double longitude;

    private final String location;

    private final Map<String,Object> items;


    public CreatePoliceIncidentsCommand(
            PoliceEventCategory category,
            String name,
            String sceneUrl, String contact,
            PoliceEventLevel policeEventLevel, String address, String reason,
            String actionTaken, String actionTendency, int policeEventType,
            double latitude, double longitude,
            String description, String location,
            Map<String,Object> items) {
        if(StringUtil.isEmpty(name)) {
            this.name = category.getTypeName();
        }else {
            this.name = name;
        }

        this.sceneUrl = sceneUrl;
        this.contact = contact;
        this.policeEventLevel = policeEventLevel;
        this.address = address;
        this.reason = reason;
        this.actionTaken = actionTaken;
        this.actionTendency = actionTendency;
        this.policeEventType = policeEventType;
        this.category = category;
        this.latitude = latitude;
        this.longitude = longitude;
        this.description = description;
        this.location = location;
        this.items = items;
    }

    public static CreatePoliceIncidentsCommand create(PoliceEventCategory category,
                                                      String name,
                                                      String sceneUrl, String contact,
                                                      PoliceEventLevel policeEventLevel, String address, String reason,
                                                      String actionTaken, String actionTendency, int policeEventType,
                                                      double latitude, double longitude,String description,
                                                      String location,
                                                      Map<String,Object> items) {
        return new CreatePoliceIncidentsCommand(
                category, name,sceneUrl, contact, policeEventLevel, address, reason,
                actionTaken, actionTendency, policeEventType, latitude, longitude,
                description,location, items);
    }
}
