package com.casic.PgInterface.devTable.domain;

import com.casic.PgInterface.patroler.domain.PgAlarmRule;
import com.casic.PgInterface.reservePlan.domain.PgReservePlan;

import javax.persistence.*;
import java.io.Serializable;
import java.util.List;

/**
 * Created by yxw on 2017/11/8.
 */
@Entity
@Table(name = "PG_ALARM_TYPE")
@SequenceGenerator(name = "SEQ_PG_ALARM__TYPE_ID", sequenceName = "SEQ_PG_ALARM__TYPE_ID", allocationSize = 1, initialValue = 1)
public class PgAlarmType implements Serializable {

    private static final long serialVersionUID = 1L;
    private long id;
    private String alarmType;//报警类型
    private int active;//标志位
    private List<PgAlarm> alarmList;
    private List<PgReservePlan> reservePlanList;
    private List<PgAlarmRule> alarmRuleList;

    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_PG_ALARM__TYPE_ID")
    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    @Column(name = "ALARM_TYPE")
    public String getAlarmType() {
        return alarmType;
    }

    public void setAlarmType(String alarmType) {
        this.alarmType = alarmType;
    }

    @Column(name = "ACTIVE")
    public int getActive() {
        return active;
    }

    public void setActive(int active) {
        this.active = active;
    }

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "alarmTypeId")
    public List<PgAlarm> getAlarmList() {
        return alarmList;
    }

    public void setAlarmList(List<PgAlarm> alarmList) {
        this.alarmList = alarmList;
    }

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "pgAlarmTypeId")
    public List<PgReservePlan> getReservePlanList() {
        return reservePlanList;
    }

    public void setReservePlanList(List<PgReservePlan> reservePlanList) {
        this.reservePlanList = reservePlanList;
    }

    @OneToMany(fetch = FetchType.LAZY, mappedBy = "alarmTypeId")
    public List<PgAlarmRule> getAlarmRuleList() {
        return alarmRuleList;
    }

    public void setAlarmRuleList(List<PgAlarmRule> alarmRuleList) {
        this.alarmRuleList = alarmRuleList;
    }
}
