/*-
 * ~~~~~~licensing~~~~~~
 * system-group-api
 * ==========
 * Copyright (C) 2020 - 2021 EmDev LLC
 * ==========
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * ~~~~~~/licensing~~~~~~
 */
package ru.entaxy.esb.system.groups.registry.jpa.entity;

import javax.persistence.*;
import java.util.Objects;

@Entity
@Table(name = "system_method_registry")
public class SystemGroupMethodRegistry {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    private long id;

    @Column(name = "method_name")
    private String methodName;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "id_system_group_registry", referencedColumnName = "id")
    private SystemGroupRegistry systemGroupRegistry;

    public long getId() {
        return id;
    }

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

    public String getMethodName() {
        return methodName;
    }

    public void setMethodName(String methodName) {
        this.methodName = methodName;
    }

    public SystemGroupRegistry getSystemGroupRegistry() {
        return systemGroupRegistry;
    }

    public void setSystemGroupRegistry(SystemGroupRegistry systemGroupRegistry) {
        this.systemGroupRegistry = systemGroupRegistry;
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, methodName, systemGroupRegistry);
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        SystemGroupMethodRegistry other = (SystemGroupMethodRegistry) obj;
        return id == other.id && Objects.equals(methodName, other.methodName);
    }

    @Override
    public String toString() {
        return "SystemGroupMethodRegistry [id=" + id + ", methodName=" + methodName + "]";
    }

}
