package com.inspect.patrol.model;

import com.inspect.base.core.utils.StringUtils;
import com.inspect.patrol.contants.PresetControlEnum;

import java.io.Serializable;

public class PresetAccessModel implements Serializable {
    private String patrolDeviceCode;
    private String channelCode;
    private String code;
    private String presetCode;
    private PresetControlEnum command;
    private String preset;
    private String serial;
    private String name;

    public String getName() {
        return StringUtils.isEmpty(this.name) ? this.code.split(StringUtils.HASHTAG)[0] + this.preset : this.name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getCode() {
        return this.code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getSerial() {
        return this.serial;
    }

    public void setSerial(String serial) {
        this.serial = serial;
    }

    public String getPreset() {
        return this.preset;
    }

    public void setPreset(String preset) {
        this.preset = preset;
    }

    public String getPatrolDeviceCode() {
        return this.patrolDeviceCode;
    }

    public void setPatrolDeviceCode(String patrolDeviceCode) {
        this.serial = this.patrolDeviceCode = patrolDeviceCode;
    }

    public String getChannelCode() {
        return this.channelCode;
    }

    public void setChannelCode(String channelCode) {
        this.code = this.channelCode = channelCode;
    }

    public String getPresetCode() {
        return this.presetCode;
    }

    public void setPresetCode(String presetCode) {
        this.preset = this.presetCode = presetCode;
    }

    public String getCommand() {
        return this.command.getValue();
    }

    public void setCommand(PresetControlEnum command) {
        this.command = command;
    }

    @Override
    public String toString() {
        return "PresetAccessModel{" +
                "patrolDeviceCode='" + patrolDeviceCode + '\'' +
                ", channelCode='" + channelCode + '\'' +
                ", code='" + code + '\'' +
                ", presetCode='" + presetCode + '\'' +
                ", command=" + command +
                ", preset='" + preset + '\'' +
                ", serial='" + serial + '\'' +
                ", name='" + name + '\'' +
                '}';
    }
}
