import uuid


def create_check_mode_user(console, create_props, update_props):
    """
    Create and return a fake local User object.
    This is used when a user needs to be created in check mode.
    """
    type_ = create_props['type']
    props = dict()

    # Defaults for some read-only properties
    if type_ == 'pattern-based':
        props['user-pattern-uri'] = 'fake-uri-{0}'.format(uuid.uuid4())
    props['password-expires'] = -1
    props['user-roles'] = []
    props['replication-overwrite-possible'] = False

    props.update(create_props)
    props.update(update_props)

    user_oid = 'fake-{0}'.format(uuid.uuid4())
    user = console.users.resource_object(user_oid, props=props)

    return user