/**
* personcompanyrole-without-required-constraint Model
* Generated: 2025-04-01T19:44:53.357Z
*/
/**
* personcompanyrole-without-required-constraint model class
*/
export class PersoncompanyroleWithoutRequiredConstraint {
/**
* Create a new personcompanyrole-without-required-constraint instance
* @param {Object} data - Initial data
*/
constructor(data = {}) {
/**
* Note Sails special attributes: autoIncrement
* @type integer
*/
this.id = data.id !== undefined ? data.id : undefined;
/**
*
* @type number
*/
this.createdAt = data.createdAt !== undefined ? data.createdAt : undefined;
/**
*
* @type number
*/
this.updatedAt = data.updatedAt !== undefined ? data.updatedAt : undefined;
/**
* The user who created this record JSON dictionary representing the **person** instance or FK when creating / updating / not populated
* @type any
*/
this.createdBy = data.createdBy !== undefined ? data.createdBy : undefined;
/**
* Whether this role assignment is currently active
* @type boolean
*/
this.isActive = data.isActive !== undefined ? data.isActive : undefined;
/**
* Whether this is the primary role for this person in this company
* @type boolean
*/
this.isPrimary = data.isPrimary !== undefined ? data.isPrimary : undefined;
/**
* JSON dictionary representing the **person** instance or FK when creating / updating / not populated
* @type any
*/
this.person = data.person !== undefined ? data.person : undefined;
/**
* JSON dictionary representing the **company** instance or FK when creating / updating / not populated
* @type any
*/
this.company = data.company !== undefined ? data.company : undefined;
/**
* JSON dictionary representing the **role** instance or FK when creating / updating / not populated
* @type any
*/
this.role = data.role !== undefined ? data.role : undefined;
}
/**
* Validate the model
* @returns {Object} - Validation result {valid: boolean, errors: Object}
*/
validate() {
const errors = {};
return {
valid: Object.keys(errors).length === 0,
errors
};
}
/**
* Convert the model to a plain object
* @returns {Object} - Plain object representation
*/
toJSON() {
const data = {};
if (this.id !== undefined) {
data.id = this.id;
}
if (this.createdAt !== undefined) {
data.createdAt = this.createdAt;
}
if (this.updatedAt !== undefined) {
data.updatedAt = this.updatedAt;
}
if (this.createdBy !== undefined) {
data.createdBy = this.createdBy;
}
if (this.isActive !== undefined) {
data.isActive = this.isActive;
}
if (this.isPrimary !== undefined) {
data.isPrimary = this.isPrimary;
}
if (this.person !== undefined) {
data.person = this.person;
}
if (this.company !== undefined) {
data.company = this.company;
}
if (this.role !== undefined) {
data.role = this.role;
}
return data;
}
/**
* Create a personcompanyrole-without-required-constraint instance from JSON data
* @param {Object} data - JSON data
* @returns PersoncompanyroleWithoutRequiredConstraint - New model instance
*/
static fromJSON(data) {
return new PersoncompanyroleWithoutRequiredConstraint(data);
}
}
export default PersoncompanyroleWithoutRequiredConstraint;