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

import com.bcxin.tenant.open.infrastructures.commands.CommandAbstract;
import com.bcxin.tenant.open.infrastructures.enums.CommunicatedType;
import com.bcxin.tenant.open.infrastructures.enums.DeskType;
import com.bcxin.tenant.open.infrastructures.enums.DispatchReasonType;
import lombok.Getter;

import java.util.Collection;

@Getter
public class CreateRoomCommand extends CommandAbstract {

    private final CommunicatedType communicatedType;
    private final int yardmanType;

    private final DispatchReasonType referenceType;
    private final String referenceNumber;
    private final Collection<CreateRoomUserCommand> roomUsers;

    private final DeskType deskType;

    public CreateRoomCommand(
            DeskType deskType,
            CommunicatedType communicatedType,
            int yardmanType,
            DispatchReasonType referenceType,
            String referenceNumber,
            Collection<CreateRoomUserCommand> roomUsers) {
        this.deskType = deskType;
        this.communicatedType = communicatedType;
        this.yardmanType = yardmanType;
        this.roomUsers = roomUsers;
        this.referenceType = referenceType;
        this.referenceNumber = referenceNumber;
    }

    public static CreateRoomCommand create(
            DeskType deskType,
            CommunicatedType communicatedType,
            int yardmanType,
            DispatchReasonType referenceType,
            String referenceNumber,
            Collection<CreateRoomUserCommand> roomUsers) {
        return new CreateRoomCommand(
                deskType,
                communicatedType, yardmanType,
                referenceType,
                referenceNumber,
                roomUsers);
    }

    @Getter
    public static class CreateRoomUserCommand extends CommandAbstract {
        private final String employeeId;
        private final String organizationId;
        private final String tencentUserId;
        private final String securityStationId;
        private final String superviseDepartId;
        private final boolean isSponsor;

        public CreateRoomUserCommand(String employeeId, String organizationId,
                                     String tencentUserId, String securityStationId,
                                     String superviseDepartId, boolean isSponsor) {
            this.employeeId = employeeId;
            this.organizationId = organizationId;
            this.tencentUserId = tencentUserId;
            this.securityStationId = securityStationId;
            this.superviseDepartId = superviseDepartId;
            this.isSponsor = isSponsor;
        }

        public static CreateRoomUserCommand create(String employeeId, String organizationId,
                                                   String tencentUserId, String securityStationId,
                                                   String superviseDepartId, boolean isSponsor) {
            return new CreateRoomUserCommand(employeeId, organizationId, tencentUserId, securityStationId, superviseDepartId, isSponsor);
        }
    }
}
