// This file was autogenerated. Please do not change.
// All changes will be overwrited on commit.
export interface IProfileInfo {
    name?: string;
}

export default class ProfileInfo {
    readonly _name: string | undefined;

    get name(): string | undefined {
        return this._name;
    }

    constructor(props: IProfileInfo) {
        if (typeof props.name === 'string') {
            this._name = props.name.trim();
        }
    }

    serialize(): IProfileInfo {
        const data: IProfileInfo = {
        };
        if (typeof this._name !== 'undefined') {
            data.name = this._name;
        }
        return data;
    }

    validate(): string[] {
        const validate = {
            name: !this._name ? true : typeof this._name === 'string' && !this._name ? true : this._name,
        };
        const isError: string[] = [];
        Object.keys(validate).forEach((key) => {
            if (!(validate as any)[key]) {
                isError.push(key);
            }
        });
        return isError;
    }

    update(props: Partial<IProfileInfo>): ProfileInfo {
        return new ProfileInfo({ ...this.serialize(), ...props });
    }
}
